I followed every step in the instruction and tried to run the example code. The code would spit out several acceleration vectors but it always ends with an Input/output error. What am I doing wrong here? The setup is shown in the picture below:
My code:
- Code: Select all | TOGGLE FULL SIZE
import time
import board
import busio
from adafruit_bno08x.i2c import BNO08X_I2C
from adafruit_bno08x import BNO_REPORT_ACCELEROMETER
i2c = busio.I2C(board.SCL, board.SDA, frequency=400000)
bno = BNO08X_I2C(i2c)
bno.enable_feature(BNO_REPORT_ACCELEROMETER)
while True:
time.sleep(1)
accel_x, accel_y, accel_z = bno.acceleration # pylint:disable=no-member
print("X: %0.6f Y: %0.6f Z: %0.6f m/s^2" % (accel_x, accel_y, accel_z))
Output:
- Code: Select all | TOGGLE FULL SIZE
Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
code.py output:
X: -0.304688 Y: -1.417969 Z: 9.578125 m/s^2
X: -0.304688 Y: -1.378906 Z: 9.613281 m/s^2
X: -0.304688 Y: -1.417969 Z: 9.578125 m/s^2
Traceback (most recent call last):
File "code.py", line 117, in <module>
File "adafruit_bno08x/__init__.py", line 601, in acceleration
File "adafruit_bno08x/__init__.py", line 796, in _process_available_packets
File "adafruit_bno08x/__init__.py", line 794, in _process_available_packets
File "adafruit_bno08x/i2c.py", line 122, in _read_packet
File "adafruit_bno08x/i2c.py", line 144, in _read
File "adafruit_bno08x/i2c.py", line 144, in _read
OSError: [Errno 5] Input/output error
Code done running.