Question: I need help with finding a code for Arduino Uno for robot's arm using two servo motors stick together. The coding below makes the second

I need help with finding a code for Arduino Uno for robot's arm using two servo motors stick together. The coding below makes the second motor move very fast and quick and the first motor turns the same. they are controlled using a joystick.

How can I slow down the speed of the moving servo motor 2 please can you provide me the code and add it to the code below?

//add the aervo library

#include

//define our servos

Servo servo1;

Servo servo2;

//define joystick pin (Analog)

int joyX =0;

int joyY =1;

//variable to read the values from the analog pins

int joyVal;

void setup()

{ //attaches our servos on pins PWM 3-5

servo1.attach(3);

servo2.attach(5);

}

void loop()

{

//read the value of joystick (between 0-1023)

joyVal = analogRead(joyX);

joyVal = map (joyVal, 0, 1023, 0, 180); //servo value between 0-180

servo1.write(joyVal); //set the servo position according to the joystick value

joyVal = analogRead(joyY);

joyVal = map (joyVal, 0, 1023, 0, 180);

servo2.write(joyVal);

delay(15);

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!