CMPS03 Compass library with only PWM support. I2C support will be added shortly, while it will arrive, you may use MBED component library if you wish to use CMPS03 I2C interface
Dependents: TestBoussole FRC_2018 0hackton_08_06_18 lib_FRC_2019 ... more
Diff: CMPS03.cpp
- Revision:
- 1:2507a3379f17
- Parent:
- 0:41ff46c0f65a
- Child:
- 2:e09ad9c1f751
diff -r 41ff46c0f65a -r 2507a3379f17 CMPS03.cpp --- a/CMPS03.cpp Fri May 18 16:36:50 2018 +0000 +++ b/CMPS03.cpp Mon May 21 16:13:10 2018 +0000 @@ -28,7 +28,7 @@ } -float CMPS03::readBearing(void) +double CMPS03::readBearing(void) { char registerNumber = COMPASS_BEARING_WORD_REG; @@ -45,7 +45,7 @@ //Register 2 [read first], was the high byte, followed by //register 3 [read second], which was the low byte. - float _i2cbearing = (((int)registerContents[0] << 8) | ((int)registerContents[1]))/10.0; + double _i2cbearing = (((int)registerContents[0] << 8) | ((int)registerContents[1]))/10.0; return _i2cbearing; @@ -64,8 +64,11 @@ } -float CMPS03::getBearing(void) +double CMPS03::getBearing(void) { return _pwmBearing; } +CMPS03::operator double() { + return _pwmBearing; +}