You are viewing an older revision! See the latest version

HerkuleX

Table of Contents

  1. Hello World!
  2. Library

This herkulex library is based on DongBu Robot documentation and protocol.

http://dasarobot.com/guide/herkulexeng.pdf

/media/uploads/passionvirus/_scaled_mbedandherkulex.png

Hello World!

Import program

00001 #include "mbed.h"
00002 #include "herkulex.h"
00003 
00004 Herkulex sv(p9, p10, 115200);
00005 DigitalOut led(LED1);
00006 
00007 int main() 
00008 {   
00009     wait(1);
00010     sv.setTorque(0xFD, TORQUE_ON);
00011     while(1) 
00012     {
00013         led=1;
00014         sv.movePos(0xFD, 1002, 100, SET_MODE_POS, SET_LED_GREEN_ON);
00015         wait(3);
00016         
00017         led=0;       
00018         sv.movePos(0xFD, 21, 100, SET_MODE_POS, SET_LED_BLUE_ON);
00019         wait(3);
00020     }
00021 }

/media/uploads/passionvirus/_scaled_mbedandherkulex.png

Library

Import library

Public Member Functions

Herkulex (PinName tx, PinName rx, uint32_t baudRate)
Create an Herkulex servo object connected to the serial pins and baudrate.
~Herkulex ()
Destroy an Herkulex servo object.
void txPacket (uint8_t packetSize, uint8_t *data)
Transmit packet datas.
void setTorque (uint8_t id, uint8_t cmdTorue)
Set Torque setting.
void movePos (uint8_t id, uint16_t pos, uint8_t playtime, uint8_t setMode, uint8_t setLED)
move position

All wikipages