Help with BNO055 Sensor Data

Hello!

I am working with the BNO055 Absolute Orientation Sensor and wanted to try and see if I could get the outputs by sending the I2C registers to the sensor, instead of using the getVector() or getEvent() functions. I tried using the following code to get the accelerometer values, but I got an error saying “no matching function for call to ‘TwoWire::read(int)’”. I’m not even sure if this is the right way to send the I2C registers to the sensor, so if you could provide any help or feedback on my code, that would be much appreciated! Also, if you have any idea what the error is referring to, please let me know as well!

Thanks for your help!

#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BNO055.h>
#include <utility/imumaths.h>
  
#define BNO055_ACCEL_DATA_X_LSB_ADDR    (0x08)
#define BNO055_ACCEL_DATA_X_MSB_ADDR    (0x09)

Adafruit_BNO055 bno = Adafruit_BNO055(55);

void setup(void) 
{
  Serial.begin(9600);
  
  /* Initialise the sensor */
  if(!bno.begin())
  {
    /* There was a problem detecting the BNO055 ... check your connections */
    Serial.print("Ooops, no BNO055 detected ... Check your wiring or I2C ADDR!");
    while(1);
  }
  
  delay(1000);
    
  bno.setExtCrystalUse(true);
}


void loop() {

float x_accel = (Wire.read(BNO055_ACCEL_DATA_X_MSB_ADDR) << 8) | (Wire.read(BNO055_ACCEL_DATA_X_LSB_ADDR));
float y_accel = (Wire.read(BNO055_ACCEL_DATA_Y_MSB_ADDR) << 8) | (Wire.read(BNO055_ACCEL_DATA_Y_LSB_ADDR));
float z_accel = (Wire.read(BNO055_ACCEL_DATA_Z_MSB_ADDR) << 8) | (Wire.read(BNO055_ACCEL_DATA_Z_LSB_ADDR));

Serial.print("ax: ");Serial.print(x_accel); Serial.print(" "); 
Serial.print("ay: ");Serial.print(y_accel); Serial.print(" ");
Serial.print("az: ");Serial.print(z_accel); Serial.println(); Serial.println();

}

What you can do is to look into the library files in your posting to see how they are using I2C to talk to the device as a hint on the direction to take. You'd want to download and read the register datasheet for the device you are using.