Control the Pololu SMC02B
Diff: SMC02B.h
- Revision:
- 0:33043894c6cb
- Child:
- 1:683f2848e917
diff -r 000000000000 -r 33043894c6cb SMC02B.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SMC02B.h Mon Oct 11 18:38:26 2010 +0000 @@ -0,0 +1,40 @@ + +#ifndef SMC02B_H +#define SMC02B_H +/** + * Includes + */ +#include "mbed.h" + +/** + * Defines + */ +#define SMC02B_START_BYTE 0x80 +#define SMC02B_CONFIG_BYTE 0x02 +#define SMC02B_DEVICE_ID 0x00 +#define SMC02B_BYTE3 0x00 +#define SMC02B_BYTE4 0x00 +#define SMC02B_MOTOR1_DIR 0x00 +#define SMC02B_MOTOR1_SPEED 0x00 +#define SMC02B_MOTOR1_NUMBER 0x00 +#define SMC02B_MOTOR2_DIR 0x00 +#define SMC02B_MOTOR2_SPEED 0x00 +#define SMC02B_MOTOR2_NUMBER 0x00 + +class SMC02B +{ +public: + SMC02B(PinName tx, PinName rx, PinName pin); + void SMC02B_RST(void); + void SMC02B_MOTOR_SET( char motor, char direction, char speed ); + void SMC02B_MOTOR_BRAKE( char motor ); + void SMC02B_MOTOR_COAST( char motor ); + void SMC02B_CONFIG( char mode, char motor ); + +private: + DigitalOut _rst; + Serial* _SMC02B; + +}; + +#endif