0

I'm using Arduino UNO and the SSC-32U board to control a robotic arm made up by 8 digital servos. At the moment, I'm correctly able to move each servo by using the following code:

 move1(servo_pin, 1680, range, time);
void move1(int servo, int position, int micro, int timer) {
   arm.print("#");
   arm.print(servo);
   arm.print(" P");
   arm.print(position);
   arm.print(" S");
   arm.print(micro);
   arm.print(" T");
   arm.println(timer);
   Serial.print("#");
   Serial.print(servo);
   Serial.print(" position:");
   Serial.println(position);
   delay(timer);
}

Now, I would like to control the robotic arm by using a PS2 Joypad and, to be more specific, to use the left and right stick and, if needed, some buttons.

I can read the analog values coming from the sticks (for example, ps2x.Analog(PSS_LY) is for the left stick), but now I would like to receive some suggestions on how to use them to move the servos.

I would like to smoothly move the robotic arm starting from its tip while I slowly move the sticks. More I move the stick, more servos should start to move.

How can I implement such behaviour?

Thank you!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.