I've converted the boebot robotic platform from the bs2 edu board to the arduino uno
i'm using the original continuous rotation servo's that came with the boebot
I have red/pos to 5v pin, black/neg to grd pin and white/control to with a 470ohm resistor (didn't have a 220) pin 10 & 11
the positive is using a jumper wire to connect to both positives on the servo, same with the ground.
I'm using the servo library and using
void setup(){
servoLeft.attach(11); // Set left servo to digital pin 10
servoRight.attach(10); // Set right servo to digital pin 9
pinMode(power_left_pin, HIGH);
pinMode(power_right_pin, LOW);
You can write a test code that tries each value from 0 to 180 to see exactly what number makes the servo stop.
awesome idea, why didn't i come up with that before?!
Some servos have a small screwdriver adjustment for the "stop" value. Send it a value of 90 and adjust until it stops.
I'll look, though i don't remember seeing one
The resistor is not necessary if these are standard servos. There is no apparent benefit, and it is possible that is the problem.
I've tried it originally without a resistor but then saw on the site somewhere that they were putting one on the signal connection, so i did too.
You are correct that 90 is the value that should make the servos stop. Of course, you should consult the documentation for the specific servos you have.
They're rebranded as parallax i think (im away at the moment) I'll see what I can find.
Many thanks for the assistance! I just wanted to be sure there wasn't something glaring that I wasn't aware of.
The simple servo test code. For continous rotation servos, the writeMicroseconds works best to find the servo stopped value.
// zoomkat 10-4-10 serial servo test
// type servo position 0 to 180 in serial monitor
// for writeMicroseconds, use a value like 1500
// for IDE 0019 and later
// Powering a servo from the arduino usually DOES NOT WORK.
String readString;
#include <Servo.h>
Servo myservo; // create servo object to control a servo
void setup() {
Serial.begin(9600);
myservo.attach(7); //the pin for the servo control
Serial.println("servo-test-21"); // so I can keep track of what is loaded
}
void loop() {
while (Serial.available()) {
delay(1);
if (Serial.available() >0) {
char c = Serial.read(); //gets one byte from serial buffer
readString += c; //makes the string readString
}
}
if (readString.length() >0) {
Serial.println(readString); //so you can see the captured string
int n;
char carray[6]; //converting string to number
readString.toCharArray(carray, sizeof(carray));
n = atoi(carray);
myservo.writeMicroseconds(n); // for microseconds
//myservo.write(n); //for degees 0-180
readString="";
}
}