We are trying to get three servo motors to work and be controlled by three different potentiometers. However, only the first one is working correctly. The other two controllers are not controlling their servo motors. When we move one servo, the other moves slightly and I know there is a way to adjust this, but can't remember what I read. Help please!
Here is the code we have:
#include <Servo.h>
// create servo object to control a servo
Servo servo1;
const int servo1PotPin =A0;
const int servo1Pin = 3;
int servo1Value;
Servo servo2;
const int servo2PotPin =A1;
const int servo2Pin = 6;
int servo2Value;
Servo servo3;
const int servo3PotPin =A2;
const int servo3Pin = 10;
int servo3Value;
void setup() {
servo1.attach (servo1Pin);
servo2.attach (servo2Pin);
servo3.attach (servo3Pin);
}
void loop () {
servo1Value = analogRead(servo1PotPin);
servo1Value = map(servo1Value, 0, 1023, 0, 180);
servo1.write(servo1Value);
servo2Value = analogRead(servo2PotPin);
servo2Value = map(servo1Value, 0, 1023, 0, 180);
servo2.write(servo2Value);
servo3Value = analogRead(servo3PotPin);
servo3Value = map(servo1Value, 0, 1023, 0, 180);
servo3.write(servo3Value);
delay(5);
}
fixed that back to Servo1PotPoin, Servo2PotPin, and Servo3PotPin. Think I changed that to test it. Uploaded it with the change and still nothing on the second or third controls and motors.
This really helped! However, the motor just wants to vibrate back and forth. Any ideas why it is doign that? When I switch it to the first potentiometer on A0, it stops and works correctly, but on A3 it isn't working right...any ideas?