servo.attach() with continuous motor

Hi,

I am at this time experimenting with the servo library. With a standard motor (0 - 190 deg.), everything is as expected.

But with a continuous motor (not a modified standard motor), I am having some concerns. To attach() the servo, I used the one parameter version of attach(), the one where you provide only the pin. Then I use the writeMicroseconds() function. Whatever parameter I pass, the motor will not run. But if I use the 3 parameters version of attach(), then the motor runs.

Is is a bug in the library, or something I misunderstand ?

Thanks

You probably wrote bad code. Also the "servo library" works with "servos".

I believe with continuous servos, degrees dont apply. You have to use -1 , 0 and 1, to specify direction. Where 0 represents no movement, -1 represents counterclockwise and 1 represents clockwise. Hope this helps!

Ok, so I was a little bit off. Here is what I was talking about.

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1240931603

I modified a couple servos a while back to drive the wheels on a router bot. I've found using the writeMicroseconds makes it easier to center the stopped position than the write. If the origional pot is retained, it can drift a bit.

http://www.lynxmotion.net/viewtopic.php?f=31&t=6388

@rickburgen:

You have to use -1 , 0 and 1, to specify direction

As far as the servo library is concerned, -1 == 0, so your theory simply will not work.

From "Servo.cpp":

void Servo::write(int value)
{  
  if(value < MIN_PULSE_WIDTH)
  {  // treat values less than 544 as angles in degrees (valid values in microseconds are handled as microseconds)
    [glow]if(value < 0) value = 0;[/glow]

zoomkat,

Also the "servo library" works with "servos".

:o Hum, and that means ? Oh, I stated I connected a continuous motor, I should have said I connected a continuous servo.

Richard,

the motor (servo) is a Parallax "STD PM BB HT HS". I could not find specs for it. If I am right, Parallax are made by other manufacturer(s). At 1500 us the motor stops. Since I don't have the numbers, I use something like 800 us and 1900 us. Looks like that increasing above the maximum and decreasing below the minimum insures it goes full speed.

Sending 0 to a continuous servo sends it full-speed counter-clockwise.
Sending 90 causes it to stop. Sending 180 causes full-speed clockwise.

This parallax works the other way, 180 is counterclockwise. This is a nice way to operate a countinuous servo.

I found out what was wrong with using attach() with only one parameter. In fact the problem was about 18" from the screen :-/. The system is remotely controlled, And there was a glitch in my code: when I was supposed to call attach() with one parameter, it was not called. When you don't attach a servo, don't expect it to work :-[.

Thanks to all of you, I learned a few things.