[chbot] servo driving
Charles Manning
manningc2 at actrix.gen.nz
Tue Aug 18 03:16:14 BST 2009
Hi All
I can't make the robotics meeting tonight. A pity since I was hoping to
discuss RC servo driving etc in the legged walker discussion.
I've been dabbling with RC driving with an AVR and have developed some code
which can drive up to 16 RC servos simultaneously (though at this stage only
8 channels are in the checked in code).
Code at http://github.com/cdhmanning/avrprojects/
The code allows you to "set and forget" and all the servo stuff is then driven
in the background by an interrupt.
The main functions to call are
servo_Initialise(); Initialise the whole party
servo_Set(portPin,time)
portPin is the pin number on PORTB. ie. 1 means controlling a servo on PORTB1.
time is the pulse width in 10s of microseconds. 100 means full anti-clockwise,
200 means full clockwise.
There is no delay in the functions themselves, so you can do things like:
//Set servos 0,1,2 to all anti-clockwise.
servo_Set(0,100);
servo_Set(1,100);
servo_Set(2,100);
// do other stuff
// Set servo 0 to anti-clockwise,servo 1 to middle, servo 2 to clockwise
servo_Set(0,100);
servo_Set(1,150);
servo_Set(2,200);
This should enable pretty simple gait control.
Have fun
Charles
More information about the Chchrobotics
mailing list