Go Down

Topic: VarSpeedServo - a modified Servo library with speed control (Read 37 times) previous topic - next topic


I would have guessed the including didn't work properly. Did you place the library in the proper directory and import it as described here: http://www.arduino.cc/en/Reference/Libraries



Hi Korman,

Yes, I have placed it correctly and it shows up in my Arduino, Sketch -> Import Library... -> VarServoSpeed. Imported it from there as well
Using Arduino 0022 btw, on Windows 7 computer.. maybe does that make any difference?


Ah never mind
Typo somewhere. Testing it now and it works fine! Thanks so much!


I have just come across this, nice job Korman.

Do you think this is a capability I should add to the core Servo library?

BTW, I posted an example sketch using this library here: http://arduino.cc/forum/index.php/topic,68305.msg504226.html#msg504226


Aug 04, 2011, 02:13 pm Last Edit: Aug 04, 2011, 02:30 pm by Korman Reason: 1
Hi Mem,

it's nice to know, that you like it. Whether to add it to the main Servo-library should be considered carefully. From my point of view, you're welcome to add the code or any modification from it. However, please consider a few things first:

  • The speed control adds more memory to the servo structure. It's just a few bytes, but in large setup with many servos, you should check if this causes problems

  • The speed parameter doesn't relate to any real time measure. It's just a number and you can set some speeds but others not. For many applications, like moving something at a pleasant speed to look at, this is good enough. If some specific speeds are necessary, the model I used might not offer enough granularity.

  • I didn't really check if the interaction of the position update and attach/detach works in a reasonable manner. What happens if one detaches the servo while on a slow move and then reattaches it?

  • The method-name slowMove is clumsy and not really in line with the rest of the rest of the methods

  • The spectrum of the available speeds isn't well used. Out of the speed byte, values above 128 are usually to fast to make visible differences because of the limits of the motor speed itself. I would like it improve this, but then I'd need more bits for the ticks parameter. If the memory isn't a problem, adding a byte to the tick counter will give more slower speeds. I think, it should also be considered what kind of speeds are going to be used most.
  • Some proper documentation and samples are also necessary.

In short, it was mostly a quick hack to get landing gears on model aircraft extend and retract at a more more realistic pace. Going by the general feedback, it seems to be of use for some applications. If you think part of my work is useful to be added to the main library, feel free to go ahead.


Go Up