Keyestudio 4DOF Manual page 151

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

Advertisement

www.keyestudio.com
s4=myservo4.read();
delay(100);
Serial.println(s4);
jiyi1[i]=s1; // Save the read servo value to the array sequentially
jiyi2[i]=s2;
jiyi3[i]=s3;
jiyi4[i]=s4;
i++;
//i plus 1
j=i;
// assign the last value of i to j
delay(100); // delay 100ms
Serial.println(i); // print out the value i
}
}
if(z2==1) // if the left joystick key is pressed
{
delay(10); // delay for eliminating shake
if(z2==1)
//judge again if the left key is pressed
{
pos1 = myservo1.read(); // memorize the angle value of 4 servo posture
pos2 = myservo2.read();
pos3 = myservo3.read();
pos4 = myservo4.read();
while(z2==1) // loop, make the arm repeat the action.
{
for(int k=1;k<j;k++) //for loop, perform all the stored actions.
{
if(pos1<jiyi1[k])
// read the angle value of servo 4 and assign it to s4
// if the current servo 1 angle is less than the value stored in array 1.
148

Advertisement

Table of Contents
loading

Table of Contents