EasyManua.ls Logo

Keyestudio 4DOF - Page 174

Keyestudio 4DOF
276 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
171
myservo4.attach(9); // set the control pin of servo 4 to D9
x1 = analogRead(right_X); // read the right X value
y1 = analogRead(right_Y); // read the right Y value
z1 = digitalRead(right_key); // read the right Z value
x2 = analogRead(left_X); // read the left X value
y2 = analogRead(left_Y); // read the left Y value
z2 = digitalRead(left_key); // read the left Z value
//delay(5); // reduce the speed overall
if(z1==1) // if the right joystick key is pressed
{
delay(10); // delay for eliminating shake
if(z1==1) // judge again if the right key is pressed
{
s1=myservo1.read(); // read the angle value of each servo
delay(100);
Serial.println(s1);
s2=myservo2.read();
delay(100);
Serial.println(s2);
s3=myservo3.read();
delay(100);
Serial.println(s3);
s4=myservo4.read();
delay(100);

Related product manuals