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.
MD03.h
00001 /* 00002 */ 00003 #include "mbed.h" 00004 00005 #ifndef MD03_H 00006 #define MD03_H 00007 00008 /* 00009 * list of registers 00010 */ 00011 #define MD03_COMMAND 0x00 00012 #define MD03_STATUS 0x01 00013 #define MD03_SPEED 0x02 00014 #define MD03_ACCELERATION 0x03 00015 #define MD03_TEMPERATURE 0x04 00016 #define MD03_MOTOR_CURRENT 0x05 00017 #define MD03_SOFTWARE_REV 0x07 00018 /* 00019 * list of command that can be sent to command register 00020 */ 00021 #define MD03_CMD_STOP 0x00 00022 #define MD03_CMD_FORWARD 0x01 00023 #define MD03_CMD_REVERSE 0x02 00024 00025 class MD03 { 00026 public: 00027 MD03(PinName sda, PinName scl, int i2cAddress); 00028 00029 void set_speed(int speed); 00030 void set_accel(int acceleration); 00031 void stop(void); 00032 void move_forward(void); 00033 void move_reverse(void); 00034 char read_reg(int register); 00035 00036 protected: 00037 I2C _i2c; 00038 char address; 00039 char _writeOpcode, _readOpcode; 00040 }; 00041 00042 #endif 00043
Generated on Wed Jul 27 2022 14:51:48 by
1.7.2