www.keyestudio.com
// turn right
if(ps2x.Analog (PSS_RX) > 200) // if push the right joystick to the right
{
//Serial.println(ps2x.Analog(PSS_RX), DEC);
pos1=pos1-1;
myservo1.write(pos1);
// delay(5);
if(pos1<1)
{
pos1=1;
}
}
// turn left
if(ps2x.Analog (PSS_RX) < 50)
{
//Serial.println(ps2x.Analog(PSS_RX), DEC);
pos1=pos1+1;
myservo1.write(pos1);
// delay(5);
if(pos1>180)
{
pos1=180;
//pos1 subtracts 1
// servo 1 carries out the action, the robot arm turns right.
// limit the right turning angle
// if push the right joystick to the left
//pos1 plus 1
// the robot arm turns left
// limit the left turning angle
241
Need help?
Do you have a question about the 4DOF and is the answer not in the manual?