pos1++; //pos1 plus 1
delay(5); // delay for 5ms,controlling the rotation speed of servo.
}
}
else // if angle of servo 1 is greater than the value stored in array 1.
{
while(pos1>s1)
//while loop,rotate the servo to the position of the value stored in the array.
{
myservo1.write(pos1); // servo 1 operates the motion
pos1--;
//pos1 subtracts 1
delay(5);
// delay for 5ms,controlling the rotation speed of servo.
}
}
//*************************************************
// the explanation is the same as servo 1
if(pos2<s2)
{
while(pos2<s2)
{
myservo2.write(pos2);
pos2++;
delay(5);
}
}
else
159
Need help?
Do you have a question about the 4DOF and is the answer not in the manual?
Questions and answers