and edit that to the main code where it read the roll and heading variables.
Alternative is to use tare function like this:
// Test tare
Serial.println("Taring BNO08x");
bno08x.tareRotationVectorNow();
bno08x.persistTare();
Serial.println("Tare done.");
Then it reset the orientation, don’t remember the exact details how it picks the orientation anymore. Don’t do this if the IMU is just a 90 degree rotation from the “correct” orientation. But with the tare you can mount the IMU in any angle or orientation. I had it in a 45 degree angle in the previous setup with no issues using the tare functionality. Undoing the tare is not straightforward, so proceed with caution and read the BNO08x manuals first!
I have it set to 90 degrees, but I don’t have much idea of programming, I’ll see if I can turn it so that it goes correctly in the box and not have to touch codes. Thank you very much for your help.
Its easiest to mount the bno using a cheap connector leads like jst. That way you can manipulate it or replace it easier. Or at least mount it with at least 6” of wire.
The direction depends how the manufacturer mounted the chip. But if its on flexible leads you can quickly test its direction and be able to use it with out programming changes or adjustment.
They seem to be immune to noise, mine is inside aluminum housing, stuck to the optoisolators on the pcb. I am not sure if there is any difference plastic housing vs aluminum. But have not had it act in any fashion that would require any changes. Seems very stable, using chinese version.