Robot team project
Dependencies: QEI Motordriver ros_lib_melodic
Diff: sensor/Sensor.cpp
- Revision:
- 2:c537f1ebad7b
- Parent:
- 1:d5adc483bce0
- Child:
- 3:a3144a45f44c
--- a/sensor/Sensor.cpp Tue Oct 22 09:41:35 2019 +0000 +++ b/sensor/Sensor.cpp Tue Oct 22 10:05:12 2019 +0000 @@ -6,7 +6,7 @@ Sensor::Sensor(PinName sda, PinName scl, PinName shdn) : i2c(sda, scl), SHDN(shdn) { - addr = DEFAULT_SENSOR_ADDRESS; + addr = DEFAULT_DEVICE_ADDRESS << 1; } /////////////////////////////////////////////////////////////////// @@ -61,7 +61,7 @@ void Sensor::changeAddress(char address) { setRegister(I2C_SLAVE_DEVICE_ADDRESS, address); - addr = address; + addr = address << 1; } /////////////////////////////////////////////////////////////////// @@ -89,7 +89,7 @@ void Sensor::startRange() { - writeByte(0x018,0x03); + writeByte(0x018,0x01); } void Sensor::pollRange()