BNO055: change I2C address during runtime

Thanks for the answer. Here is a piece of the output of the code above in the serial monitor (in the loop):

First address:
X: 26.0625	Y: 13.3750	Z: 118.9375 CALIBRATION: Sys=0 G=3 A=3 M=3
Second address:
X: -0.0625	Y: -0.0625	Z: -0.0625 CALIBRATION: Sys=3 G=3 A=3 M=3
First address:
X: 102.1250	Y: 63.1875	Z: 115.7500 CALIBRATION: Sys=0 G=3 A=3 M=3
Second address:
X: -0.0625	Y: -0.0625	Z: -0.0625 CALIBRATION: Sys=3 G=3 A=3 M=3
First address:
X: 111.5000	Y: 52.0625	Z: 34.5000 CALIBRATION: Sys=0 G=3 A=3 M=3
Second address:
X: -0.0625	Y: -0.0625	Z: -0.0625 CALIBRATION: Sys=3 G=3 A=3 M=3
First address:
X: 114.3750	Y: 51.8750	Z: 27.8125 CALIBRATION: Sys=0 G=3 A=3 M=3
Second address:
X: -0.0625	Y: -0.0625	Z: -0.0625 CALIBRATION: Sys=3 G=3 A=3 M=3

While "First address" changes when moving the sensor, "Second address" just returns random values. As you said, it seems that the address change is not noticed. So how do I get the CPU read the new address? A system reset would mean the sensor has to calibrate again, doesnt it? I would like to avoid that.

I hardwired the ADR pin of the sensor to low and high, and addressing the sensor at either address works perfectly.

Thanks for your help.

1 Like