EasyManua.ls Logo

Keyestudio 4DOF - Page 252

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...
249
}
}
//***************************************************************
void zhuazi()
{
// close the claw
if(ps2x.Analog(PSS_LX)>220) // if push the left joystick to the right
{
pos4=pos4-1;
Serial.println(pos4);
myservo4.write(pos4); // servo 4 carries out the action and the claw is gradually closed.
delay(5);
if(pos4<0) // if pos4 value reduces to 37(the claw we test in 37degrees is closed)
{
pos4=0;
}
}
// open the claw
if(ps2x.Analog(PSS_LX)<10) // if push the left joystick to the left
{
pos4=pos4+8;
Serial.println(pos4);
myservo4.write(pos4); // servo 4 carries out the action and the claw is gradually opened
delay(5);
if(pos4>108) // limit the maximum angle opened
{

Related product manuals