Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed ADS1115 StepperMotor SRF05 TPA81new
Dynamixel.h@0:79e2a8171b16, 2015-08-18 (annotated)
- Committer:
- dmgongora
- Date:
- Tue Aug 18 09:15:09 2015 +0000
- Revision:
- 0:79e2a8171b16
- Child:
- 1:ef90d942ce78
First working version of the Dynamixel class
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| dmgongora | 0:79e2a8171b16 | 1 | #ifndef DEF_DYNAMIXEL |
| dmgongora | 0:79e2a8171b16 | 2 | #define DEF_DYNAMIXEL |
| dmgongora | 0:79e2a8171b16 | 3 | |
| dmgongora | 0:79e2a8171b16 | 4 | #include "mbed.h" |
| dmgongora | 0:79e2a8171b16 | 5 | // Instruction set |
| dmgongora | 0:79e2a8171b16 | 6 | const unsigned char PING = 0x01; |
| dmgongora | 0:79e2a8171b16 | 7 | const unsigned char READ_DATA = 0x02; |
| dmgongora | 0:79e2a8171b16 | 8 | const unsigned char WRITE_DATA = 0x03; |
| dmgongora | 0:79e2a8171b16 | 9 | const unsigned char REG_WRITE = 0x04; |
| dmgongora | 0:79e2a8171b16 | 10 | const unsigned char ACTION = 0x05; |
| dmgongora | 0:79e2a8171b16 | 11 | const unsigned char RESET = 0x06; |
| dmgongora | 0:79e2a8171b16 | 12 | const unsigned char SYNC_WRITE = 0x83; |
| dmgongora | 0:79e2a8171b16 | 13 | // Control table |
| dmgongora | 0:79e2a8171b16 | 14 | const unsigned char ADDRESS_PRESENT_TEMPERATURE = 0x2B; |
| dmgongora | 0:79e2a8171b16 | 15 | const unsigned char ADDRESS_GOAL_POSITION = 0x1E; |
| dmgongora | 0:79e2a8171b16 | 16 | const unsigned char ADDRESS_LED = 0x19; |
| dmgongora | 0:79e2a8171b16 | 17 | |
| dmgongora | 0:79e2a8171b16 | 18 | class Dynamixel |
| dmgongora | 0:79e2a8171b16 | 19 | { |
| dmgongora | 0:79e2a8171b16 | 20 | public: |
| dmgongora | 0:79e2a8171b16 | 21 | Dynamixel(PinName tx, PinName rx, PinName txEnable, uint8_t motorID, int baudrate); |
| dmgongora | 0:79e2a8171b16 | 22 | void ping(); |
| dmgongora | 0:79e2a8171b16 | 23 | void toggleLED(uint8_t ledState); |
| dmgongora | 0:79e2a8171b16 | 24 | void move(uint16_t position); |
| dmgongora | 0:79e2a8171b16 | 25 | private: |
| dmgongora | 0:79e2a8171b16 | 26 | Serial m_link; |
| dmgongora | 0:79e2a8171b16 | 27 | DigitalOut m_txEnable; |
| dmgongora | 0:79e2a8171b16 | 28 | uint8_t m_motorID; |
| dmgongora | 0:79e2a8171b16 | 29 | const int m_baudrate; |
| dmgongora | 0:79e2a8171b16 | 30 | }; |
| dmgongora | 0:79e2a8171b16 | 31 | #endif |