Dan Gongora
/
dynamixel_wheel_test
Tested on MX-28
Fork of dynamixel_test by
Revision 4:7ee9ae120e73, committed 2015-10-25
- Comitter:
- dmgongora
- Date:
- Sun Oct 25 05:41:42 2015 +0000
- Parent:
- 3:e5577be2fe70
- Commit message:
- Wheel mode working example
Changed in this revision
Dynamixel.lib | Show annotated file Show diff for this revision Revisions of this file |
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r e5577be2fe70 -r 7ee9ae120e73 Dynamixel.lib --- a/Dynamixel.lib Wed Aug 19 05:42:25 2015 +0000 +++ b/Dynamixel.lib Sun Oct 25 05:41:42 2015 +0000 @@ -1,1 +1,1 @@ -https://developer.mbed.org/users/dmgongora/code/Dynamixel/#fb8a2d249639 +https://developer.mbed.org/users/dmgongora/code/Dynamixel/#edba46e8f8b4
diff -r e5577be2fe70 -r 7ee9ae120e73 main.cpp --- a/main.cpp Wed Aug 19 05:42:25 2015 +0000 +++ b/main.cpp Sun Oct 25 05:41:42 2015 +0000 @@ -1,7 +1,7 @@ /***************************************************** - Description: mbed to Dynamixel connection test using the library -- Requirements: +- Requirements: Dynamixel (i.e. DX116, RX28) MAX3088/MAX485 (RS485 transceiver) - Connections: @@ -10,30 +10,47 @@ Pin 1 -- Pin 14 Pin 2 -- Pin 15 Pin 4 -- Pin 13 - + - Comments: - See schematic for wiring details and class + See schematic for wiring details and class documentation for available methods. *****************************************************/ #include "mbed.h" #include "Dynamixel.h" +DigitalOut debug1(LED1); +DigitalOut debug2(LED2); +DigitalOut debug3(LED3); +DigitalOut debug4(LED4); int main() { - Dynamixel DX116(p13, p14, p15, 9, 57600); - - DX116.toggleLED(1); - wait(0.5); - DX116.toggleLED(0); - DX116.setSpeed(0); - wait(0.5); - DX116.move(0); // MOVE + debug1 = 0; + debug2 = 0; + debug3 = 0; + debug4 = 0; + Dynamixel motor2(p13, p14, p15, 1, 57600); // TX, RX, TX_ENABLE, MOTOR_ID, BD + + /************************** + *** Check communication *** + **************************/ + motor2.toggleLED(1); wait(1); - DX116.setSpeed(100); + motor2.toggleLED(0); + /************************** + ***** Set max angles ***** + **************************/ + motor2.setAngleLimit(0, ADDRESS_CW_ANGLE_LIMIT); + wait(0.5); + motor2.setAngleLimit(0, ADDRESS_CCW_ANGLE_LIMIT); wait(0.5); - DX116.move(1023); // MOVE - wait(1); - DX116.setSpeed(1023); - wait(1); - DX116.move(0); // MOVE -} \ No newline at end of file + /************************** + ******** Set speed ******** + **************************/ + motor2.setSpeed(50); // 0-1023 CW + debug1 = 1; + wait(2); + motor2.setSpeed(2000); // 1024-2047 CCW + wait(2); + debug2 = 1; + motor2.setSpeed(0); +} \ No newline at end of file