Simple test

Ensure your device works with this simple test.

examples/bno08x_rvc_simpletest.py
 1# SPDX-FileCopyrightText: 2020 Bryan Siepert, written for Adafruit Industries
 2#
 3# SPDX-License-Identifier: Unlicense
 4import time
 5import board
 6import busio
 7
 8uart = busio.UART(board.TX, board.RX, baudrate=115200, receiver_buffer_size=2048)
 9
10# uncomment and comment out the above for use with Raspberry Pi
11# import serial
12# uart = serial.Serial("/dev/serial0", 115200)
13
14# for a USB Serial cable:
15# import serial
16# uart = serial.Serial("/dev/ttyUSB0", baudrate=115200)
17
18from adafruit_bno08x_rvc import BNO08x_RVC  # pylint:disable=wrong-import-position
19
20rvc = BNO08x_RVC(uart)
21
22while True:
23    yaw, pitch, roll, x_accel, y_accel, z_accel = rvc.heading
24    print("Yaw: %2.2f Pitch: %2.2f Roll: %2.2f Degrees" % (yaw, pitch, roll))
25    print("Acceleration X: %2.2f Y: %2.2f Z: %2.2f m/s^2" % (x_accel, y_accel, z_accel))
26    print("")
27    time.sleep(0.1)