Keyestudio 4DOF Manual page 118

Robot arm kit
Hide thumbs Also See for 4DOF:
Table of Contents

Advertisement

www.keyestudio.com
pinMode(right_key, INPUT);
pinMode(left_key, INPUT);
Serial.begin(9600); // set the baud rate to 9600
}
void loop()
{
myservo1.attach(A1); // set the control pin of servo 1 to A1
myservo2.attach(A0); // set the control pin of servo 2 to A0
myservo3.attach(6);
myservo4.attach(9);
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 key 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 key Z value
//delay(5); // reduce the speed overall
if(z1==1) // if the right joystick key is pressed
{
// set the right/left key to INPUT
//set the control pin of servo 3 to D6
//set the control pin of servo 4 to D9
115

Advertisement

Table of Contents
loading

Table of Contents