EasyManua.ls Logo

Keyestudio 4DOF - Page 190

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...
187
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); // delay, used to reduce the joystick value read, that is reduce the whole speed.
if(z1==1) // if the joystick right 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 servo 1 and assign it to s1
delay(100);
Serial.println(s1); // print out the angle value of servo 1 on the serial monitor
s2=myservo2.read(); // read the angle value of servo 2 and assign it to s2
delay(100);
Serial.println(s2);
s3=myservo3.read(); // read the angle value of servo 3 and assign it to s3
delay(100);
Serial.println(s3);
s4=myservo4.read(); // read the angle value of servo 4 and assign it to s4
delay(100);
Serial.println(s4);

Related product manuals