if(pos3>180) // limit the stretched angle
{
pos3=180;
}
}
if(y2>1000) // if push the left joystick downward
{
pos3=pos3-1;
myservo3.write(pos3); // lower arm will draw back
delay(5);
if(pos3<35) // limit the retracted angle
{
pos3=35;
}
}
}
***************************************************************************************************************************
Test Result:
Upload the code to main board and stack the shield onto it. Wire it up, 4DOF robot arm will keep the initial position,
push the two Joysticks to operate the robot arm.