Adafruit_CircuitPython_BNO055 icon indicating copy to clipboard operation
Adafruit_CircuitPython_BNO055 copied to clipboard

How to get output in LSB for Python application?

Open dimitrigrigoriev opened this issue 3 years ago • 1 comments

Currently, the Python library gives an output for accelerations and g-components as floats with two-digit accuracy. Is it possible to get actual output in LSB to convert to m/s2 using range and with better accuracy?

dimitrigrigoriev avatar Jan 18 '22 10:01 dimitrigrigoriev

You can check the underscore attributes for the class and use the registers mentioned there to directly read the registers. For example:

class BNO055_I2C(BNO055):
    """
    Driver for the BNO055 9DOF IMU sensor via I2C.
    """

    _temperature = _ReadOnlyUnaryStruct(0x34, "b")
    _acceleration = _ScaledReadOnlyStruct(0x08, "<hhh", 1 / 100)

    ...

In this case, the register for temperature is 0x34 and the register for acceleration is 0x08. If you're familiar with how the struct module works, that string is the format of the return (https://docs.python.org/3/library/struct.html).

tekktrik avatar Mar 01 '22 17:03 tekktrik

Closing. Above is the answer.

caternuson avatar Nov 04 '22 16:11 caternuson