Hi guys pleasee could I have some help trying to read off values from the bno055 sensor without using the library, don't really know how to do it but this is what I have got. I also set the bandwidth to 1000hz and max g range
#include <Wire.h>`
#include <Adafruit_Sensor.h>
#define BNO055_ACC_ID 0xFB
#define BNO055_ACC_CONFIG 0x08
#define BNO055_ADDRESS 0x28
#define BNO055_PAGE_ID 0x07
#define BNO055_OPR_MODE 0x3D
#define BNO055_ACCEL_DATA_X_LSB_ADDR 0X08
#define BNO055_ACCEL_DATA_X_MSB_ADDR 0X09
#define BNO055_ACCEL_DATA_Y_LSB_ADDR 0X0A
#define BNO055_ACCEL_DATA_Y_MSB_ADDR 0X0B
#define BNO055_ACCEL_DATA_Z_LSB_ADDR 0X0C
#define BNO055_ACCEL_DATA_Z_MSB_ADDR 0X0D
enum Abw { // ACC Bandwidth
ABW_7_81Hz = 0,
ABW_1000Hz = 0x1C //0x07
};
enum APwrMode { // ACC Pwr Mode
NormalA = 0,
};
enum Ascale { // ACC Full Scale
AFS_2G = 0,
AFS_16G = 0x03
};
enum OPRMode { // BNO-55 operation modes
CONFIGMODE = 0x00,
ACCONLY = 0x01,
};
void setup(void)
{
Serial.begin(115200);
delay(30);
Wire.begin();
delay(30);
Wire.setClock(100000);
delay(30);
settingUp();
delay(30);
}
void loop(void)
{
int myTime = millis();
int array[7000][7];
for ( int x = 0x08; x < 0xE ; x++)
{
byte a = readByte(BNO055_ADDRESS, x);
Serial.print(a);
Serial.print(",");
}
Serial.print("\n");
}
uint8_t readByte(uint8_t address, uint8_t subAddress)
{
uint8_t data; // `data` will store the register data
Wire.beginTransmission(address); // Initialize the Tx buffer
Wire.write(subAddress); // Put slave register address in Tx buffer
Wire.endTransmission(false); // Send the Tx buffer, but send a restart to keep connection alive
// Wire.endTransmission(false); // Send the Tx buffer, but send a restart to keep connection alive
// Wire.requestFrom(address, 1); // Read one byte from slave register address
Wire.requestFrom(address, (size_t) 1); // Read one byte from slave register address
data = Wire.read(); // Fill Rx buffer with result
return data; // Return data read from slave register
}
void writeByte(uint8_t address, uint8_t subAddress, uint8_t data)
{
Wire.beginTransmission(address); // Initialize the Tx buffer
Wire.write(subAddress); // Put slave register address in
Wire.write(data); //
Wire.endTransmission(); //
}
void settingUp() {
writeByte(BNO055_ADDRESS, BNO055_OPR_MODE, CONFIGMODE );
writeByte(BNO055_ADDRESS, BNO055_PAGE_ID, 0x01);
writeByte(BNO055_ADDRESS, BNO055_ACC_CONFIG, NormalA | ABW_1000Hz | AFS_16G );
writeByte(BNO055_ADDRESS, BNO055_PAGE_ID, 0x00);
writeByte(BNO055_ADDRESS, BNO055_OPR_MODE, 0x01 );
}