If I understand correctly using the Adafruit_Sensor
one can extract information from the sensor specific information. These sensors are currently mentioned in the README
. I am using the BNO055 for two things:
- Orientation values (Heading, pitch, roll)
- Linear Acceleration values
My code is similar to the Example mentioned Adafruit_BNO055's bunny
Code
I tried the following in my loop()
void loop() {
// put your main code here, to run repeatedly:
sensors_event_t event;
bno.getEvent(&event);
Serial.print(F("Orientation: "));
Serial.print((float)event.orientation.x);
Serial.print(F(" "));
Serial.print((float)event.orientation.y);
Serial.print(F(" "));
Serial.print((float)event.orientation.z);
Serial.println(F(""));
Serial.print(F("Acceleration: "));
Serial.print((float)event.acceleration.x);
Serial.print(F(" "));
Serial.print((float)event.acceleration.y);
Serial.print(F(" "));
Serial.print((float)event.acceleration.z);
Serial.println(F(""));
delay(BNO055_SAMPLERATE_DELAY_MS);
}
Created sensors_event_t event
and used the orientation
and acceleration
parameters to obtain the orientation and acceleration values in x, y, z directions.
output
The orientation and accleration values are the same:
Orientation: 105.50 -20.56 -101.00
Acceleration: 105.50 -20.56 -101.00
Orientation: 97.81 -14.69 -119.56
Acceleration: 97.81 -14.69 -119.56
Orientation: 93.81 -10.94 -125.56
Acceleration: 93.81 -10.94 -125.56
Orientation: 94.44 -12.25 -122.56
I tried adding another event event1
in the loop()
but I still get the same results
sensors_event_t event;
bno.getEvent(&event);
Serial.print(F("Orientation: "));
Serial.print((float)event.orientation.x);
Serial.print(F(" "));
Serial.print((float)event.orientation.y);
Serial.print(F(" "));
Serial.print((float)event.orientation.z);
Serial.println(F(""));
sensors_event_t event1;
bno.getEvent(&event1);
Serial.print(F("Acceleration: "));
Serial.print((float)event1.acceleration.x);
Serial.print(F(" "));
Serial.print((float)event1.acceleration.y);
Serial.print(F(" "));
Serial.print((float)event1.acceleration.z);
Serial.println(F(""));
delay(BNO055_SAMPLERATE_DELAY_MS);
Can't the BNO055 along with the Adafruit_Sensor library not provide the acceleration and orientation values as events or is the library used only to obtain orientation values from the BNO055?
0x28
and0x68
. Also I have an RTC connected to the I2C bus.0x28
is the secondary address and hence it is detected.