Hello
I built a robot claw/gripper with a pan and tilt from parts from Spark fun
Have major issues with cross talk on the signal wires. If i run one servo at a time it runs just fine
If i have more then one hooked up at a time forget it. Complete crazy movement.
Im assuming its interference on the servo signal wire. Has anyone heard of a fix for this.
Its all on a separate supply of course
The servos are being controlled from an analog read from a pot. No big deal.
Def major issues here and my project is due in a few days. Anyone have any ideas?
Here is the simple code for it
//
#include <Servo.h>
Servo grip_servo;
Servo pan_servo;
Servo tilt_servo;
int pot_grip_pin = 0;
int pot_pan_pin = 1;
int pot_tilt_pin = 2;
int val=0;
int pot_grip_pin_value;
int pot_pan_pin_value;
int pot_tilt_pin_value;
void setup()
{
grip_servo.attach(13); // attaches grip servo on pin 13 to the servo object
pan_servo.attach(1); //attach pan servo to Digital pin 1
tilt_servo.attach(7);//attach tilt servo to pin 7
}
void loop()
{
pot_pan_pin_value = analogRead(5); // reads the value of the potentiometer (value between 0 and 1023)
pot_pan_pin_value = map(pot_pan_pin_value, 20, 1000, 0, 179); // scale it to use it with the servo (value between 0 and 180)
pan_servo.write(pot_pan_pin_value); // sets the servo position according to the scaled value
delay(15); // waits for the servo to get there
pot_grip_pin_value = analogRead(4); // reads the value of the potentiometer (value between 0 and 1023)
pot_grip_pin_value = map(pot_grip_pin_value, 20, 400, 0, 179); // scale it to use it with the servo (value between 0 and 180)
grip_servo.write(pot_grip_pin_value); // sets the servo position according to the scaled value
delay(15);
pot_tilt_pin_value = analogRead(3); // reads the value of the potentiometer (value between 0 and 1023)
pot_tilt_pin_value = map(pot_tilt_pin_value, 200, 1000, 0, 179); // scale it to use it with the servo (value between 0 and 180)
tilt_servo.write(pot_tilt_pin_value); // sets the servo position according to the scaled value
delay(15);
}