Keyestudio 4DOF Manual page 149

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

Advertisement

www.keyestudio.com
const int left_Y = A4; // define the left Y pin to A4
const int left_key = 8; // define the left key pin to 8(that is Z value)
int x1,y1,z1; // define the variable, used to save the joystick value.
int x2,y2,z2;
int s1,s2,s3,s4;
int jiyi1[20]; //define 4 array, separately used to save the angle of four servo.
int jiyi2[20]; // (array length is 20,namely can save angle data of 0~20 servo)
int jiyi3[20]; //if need to save more data, just change the number 20 to be more larger number.
int jiyi4[20];
int i=0; // for loop
int j=0; // save the last value of i
void setup()
{
// boot posture
myservo1.write(pos1); //turn servo 1 to 90 degrees
delay(1000);
myservo2.write(pos2); // turn servo 2 to 90 degrees
myservo3.write(pos3); // turn servo 3 to 120 degrees
myservo4.write(pos4); // turn servo 4 to 35 degrees
delay(1500);
pinMode(right_key, INPUT);
pinMode(left_key, INPUT);
Serial.begin(9600);
}
// set the right/left key to INOUT
// set the baud rate to 9600
146

Advertisement

Table of Contents
loading

Table of Contents