I don’t understand why my robotic arm is not working. If anyone can tell me why, based on the description below, before three o’clock pm, I would appreciate it.
I have:
-four servos (3 are HS422s, one is the “medium servo” from Sparkfun) connected to an Arduino; one with signal to pin 6, one to pin 9, one to pin 10, and one to 11
-each of the servo’s are in parallel to the power source (which is the 5 volt breadboard power supply from Sparkfun)
-four 10K pots (2 are in a joystick config, however) connected to Arduino; one on analog pin 0, one on 1, one on 2 and one on 3
-the grounds are connected
-the Arduino is powered via USB, the rest via the power supply
Arduino is running this code:
#include <Servo.h>
Servo sm1;
Servo sm2;
Servo sm3;
Servo sm4;
int pot1 = 0;
int pot2 = 1;
int pot3 = 2;
int pot4 = 3;
int val1;
int val2;
int val3;
int val4;
void setup() {
sm1.attach(6);
sm2.attach(9);
sm3.attach(10);
sm4.attach(11);
}
void loop() {
val1 = analogRead(pot1);
val2 = analogRead(pot2);
val3 = analogRead(pot3);
val4 = analogRead(pot4);
val1 = map(val1, 0, 1023, 0, 179);
val2 = map(val2, 0, 1023, 0, 179);
val3 = map(val3, 0, 1023, 0, 179);
val4 = map(val4, 0, 1023, 0, 179);
sm1.write(val1);
sm2.write(val2);
sm3.write(val3);
sm4.write(val4);
delay(15);
}
The motors dont respond at all until I unplug one or two, and then they jerk around and go crazy. Please help me!