PDA

View Full Version : Dongbu Herkulex library for Arduino



robottini
12-15-2012, 12:55 AM
I wrote a library to control Dongbu Herkulex with Arduino.

It works with Arduino Mega and Arduino Uno/2009.

You can find it all details here: http://robottini.altervista.org/dongbu-herkulex-arduino-library-2

I hope can be useful.

This is the list of the commands supported:




begin(long baud, int rx, int tx)
start the communication between Arduino Uno/2009 and Herkulex


beginSerial1(long baud)
start the communication between Arduino Mega and Herkulex using the Serial Port 1


beginSerial2(long baud)
start the communication between Arduino Mega and Herkulex using the Serial Port 2


beginSerial3(long baud)
start the communication between Arduino Mega and Herkulex using the Serial Port 3


end()
stop the communication between Arduino and Herkulex


initialize()
initialize all the motors


stat(int servoID)
ask for the motor status to control the errors


ACK(int valueACK)
set the answer of the motors to a request (verbose or not verbose)


set_ID(int ID_Old, int ID_New)
change the ID of the motor


clearError(int servoID)
clear the motor error


torqueON(int servoID)
set the motor torque to ON


torqueOFF(int servoID)
set the motor torque to OFF


moveAll(int servoID, int Goal, int iLed)
prepare the motors to execute the movement in the same time to position (same start time - end time) – unison movement


moveAllAngle(int servoID, float angle, int iLed)
prepare the motors to execute the movement in the same time to angle (same start time - end time) – unison movement


moveSpeedAll(int servoID, int Goal, int iLed)
prepare the motors to execute the movement in continuous rotation with same start time and end time – unison movement


actionAll(int pTime)
execute the unison movement


moveSpeedOne(int servoID, int Goal, int pTime, int iLed)
move continously a motor with a specified speed


moveOne(int servoID, int Goal, int pTime, int iLed)
move one motor to an absolute position


moveOneAngle(int servoID, float angle, int pTime, int iLed)
move one motor to an angle


getPosition(int servoID)
get the motor position


getAngle(int servoID)
get the position in degrees


getSpeed(int servoID)
get the motor speed (Continuously rotation)


reboot(int servoID)
reboot the motor


setLed(int servoID, int valueLed)
set the led color


writeRegistryRAM(int servoID, int address, int writeByte)
write a value in a register in the RAM memory


writeRegistryEEP(int servoID, int address, int writeByte)
write a value in a register in the ROM memory

mcintosh
12-15-2012, 04:03 PM
This looks great!
Thanks for sharing the code.
I will certainly be buying some of these motors to experiment with and I appreciate having your arduino library.