PDA

View Full Version : Help with servo read position



starstorms
04-19-2012, 08:23 PM
Could someone help me read the position of a servo in the arduino environment using the ax12 and bioloid libraries. There is a convienent SetPosition function but i cant seem to use the GetRegister to read the position. I would appreciate any help in reading the servo position as a number between 0 and 1024.

lnxfergy
04-21-2012, 04:36 AM
So, the definition of ax12GetRegister is:


ax12GetRegister(int id, int regstart, int length);

So, you want to read AX_PRESENT_POSITION_L & AX_PRESENT_POSITION_H (position is a 2-byte register), thus:


ax12GetRegister(1, AX_PRESENT_POSITION_L, 2);

would read the position of servo with ID1.

-Fergs