Routines to control a MD03 H-bridge module.
Revision 1:0afd9f1a4e4f, committed 2015-11-07
- Comitter:
- jimherd
- Date:
- Sat Nov 07 22:31:25 2015 +0000
- Parent:
- 0:7efb3e6f7c7a
- Commit message:
- Working version
Changed in this revision
MD03.cpp | Show annotated file Show diff for this revision Revisions of this file |
MD03.h | Show annotated file Show diff for this revision Revisions of this file |
diff -r 7efb3e6f7c7a -r 0afd9f1a4e4f MD03.cpp --- a/MD03.cpp Thu Jun 25 19:55:40 2015 +0000 +++ b/MD03.cpp Sat Nov 07 22:31:25 2015 +0000 @@ -7,6 +7,8 @@ MD03::MD03(PinName sda, PinName scl, int i2cAddress) : _i2c(sda, scl) { _writeOpcode = i2cAddress & 0xFE; _readOpcode = i2cAddress | 0x01; + + _i2c.frequency(100000); } void MD03::set_speed(int speed)
diff -r 7efb3e6f7c7a -r 0afd9f1a4e4f MD03.h --- a/MD03.h Thu Jun 25 19:55:40 2015 +0000 +++ b/MD03.h Sat Nov 07 22:31:25 2015 +0000 @@ -34,8 +34,7 @@ char read_reg(int register); protected: -// I2C &_i2c; - I2C _i2c; + I2C _i2c; char address; char _writeOpcode, _readOpcode; };