by themselves, the servos work fine although weird stuff starts happening when i try to use them together
with the sweep example, if i just create more servo objects and attach them to the pins that my other servos are connected to, the other servos turn and stay at a position without calling the write() method for them
also with this code:
#include <Servo.h>
int stationaryTurnServo = 1588;
int BSP = 7; //servo data pins
int ESP = 8;
int TSP = 12;
where turnServo is a servo modified for continuous rotation, the elbow servo goes to 90 but i can turn it past 90 as if it were unpowered
but when i turn it below 90 with my hands, it gives resistance and makes the turnServo turn
i am new to arduino so this problem might have a pretty easy fix that you might think is too obvious to consider like "remember to upload your code"
First guess (as it is a common error, and you do not state anything that indicates contrary) you're not powering them correct. What is your powersupply to the servos? In fact, let us see have the whole circuit (Arduino, power, Servos).
my power supply is 4 AA batteries and the arduino is powered by my computer
AA batteries are plugged into a breadboard's power rail and the grounds are connected
the power and ground wires on the servo are connected to the power rail on the breadboard and the data wire goes into the arduino
here is a picture that probably isnt very helpful as everything looks pretty messy:
Not sure what your code is supposed to do, but here is the servo sweep code modified for three servos on pins 6, 7, and 8 (tested with servos on pins 6 and 7).
// Sweep
// by BARRAGAN <http://barraganstudio.com>
// This example code is in the public domain.
#include <Servo.h>
Servo myservo6; // create servo object to control a servo
Servo myservo7; // a maximum of eight servo objects can be created
Servo myservo8;
int pos = 0; // variable to store the servo position
void setup()
{
myservo6.attach(6); // attaches the servo on pin 9 to the servo object
myservo7.attach(7);
myservo8.attach(8);
}
void loop()
{
for(pos = 0; pos < 180; pos += 1) // goes from 0 degrees to 180 degrees
{ // in steps of 1 degree
myservo6.write(pos); // tell servo to go to position in variable 'pos'
myservo7.write(pos);
myservo8.write(pos);
delay(15); // waits 15ms for the servo to reach the position
}
for(pos = 180; pos>=1; pos-=1) // goes from 180 degrees to 0 degrees
{
myservo6.write(pos); // tell servo to go to position in variable 'pos'
myservo7.write(pos);
myservo8.write(pos); // tell servo to go to position in variable 'pos'
delay(15); // waits 15ms for the servo to reach the position
}
}
alright i think i fixed it
i just added 4 more AA batteries in parrallel and 2 1000uF capacitors on the power rail and the servos seemed to stop interfering with each other
thanks for the help!