EasyManua.ls Logo

Keyestudio 4DOF - Page 180

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...
177
void zhuazi()
{
//claw
if(x2<50) // if push the left joystick to the right
{
pos4=pos4-2; // angle of servo 4, subtract 2 (change the value you subtract, thus change the closed speed of claw)
//Serial.println(pos4);
myservo4.write(pos4); // servo 4 operates the motion and claw is gradually closed.
delay(5);
if(pos4<2) // if pos4 value subtracts to 2, the claw in 37 degrees we have tested is closed.
{ //(should change the value based on the fact)
pos4=2; // stop subtraction when reduce to 2
}
}
if(x2>1000) //// if push the left joystick to the left
{
pos4=pos4+8; // current angle of servo 4 plus 8(change the value you plus, thus change the open speed of claw)
//Serial.println(pos4);
myservo4.write(pos4); // servo 4 operates the action, claw gradually opens.
delay(5);
if(pos4>90) // limit the largest angle opened
{
pos4=90;
}
}
}

Related product manuals