Robot team project
Dependencies: QEI Motordriver ros_lib_melodic
Diff: sensor/Sensor.cpp
- Revision:
- 4:cb50c6fa340b
- Parent:
- 3:a3144a45f44c
- Child:
- 5:8ef79eebbc97
diff -r a3144a45f44c -r cb50c6fa340b sensor/Sensor.cpp --- a/sensor/Sensor.cpp Tue Oct 22 10:09:05 2019 +0000 +++ b/sensor/Sensor.cpp Tue Oct 22 11:52:32 2019 +0000 @@ -13,9 +13,6 @@ wait_ms(0.5); } -/////////////////////////////////////////////////////////////////// -// TODO -/////////////////////////////////////////////////////////////////// int Sensor::init() { // Turn on the device @@ -74,9 +71,9 @@ /////////////////////////////////////////////////////////////////// // New measurement /////////////////////////////////////////////////////////////////// -int Sensor::read() +float Sensor::read() { - int range; + float range; // Start range measurement startRange(); @@ -115,11 +112,11 @@ } } -int Sensor::readRange() +float Sensor::readRange() { - int range; + char range; range = readByte(RESULT_RANGE_VAL); - return range; + return (float)range; } void Sensor::clearInterrupts()