From 4158ee89ccd37549d9bf24c07fbe715ae01c3501 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=BC=80=E6=99=BA?= Date: Fri, 29 Mar 2019 22:26:51 +0800 Subject: [PATCH] imu shield example --- scripts/examples/29-IMU-Shield/imu_read.py | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 scripts/examples/29-IMU-Shield/imu_read.py diff --git a/scripts/examples/29-IMU-Shield/imu_read.py b/scripts/examples/29-IMU-Shield/imu_read.py new file mode 100644 index 000000000..f9eae8530 --- /dev/null +++ b/scripts/examples/29-IMU-Shield/imu_read.py @@ -0,0 +1,23 @@ +from machine import I2C +from bno055 import BNO055, AXIS_P7 +import time +i2c = I2C(2) +imu = BNO055(i2c) +while True: + #temperature = imu.temperature() + #print('temperature: ℃',temperature) + yaw, roll, pitch = imu.euler() + print('yaw, roll, pitch: °', yaw, roll, pitch) + #w, x, y, z = imu.quaternion() + #print('Quaternion:', w, x, y, z) + #x, y, z = imu.accelerometer() + #print('Accelerometer (m/s^2):', x, y, z) + #x, y, z = imu.magnetometer() + #print('Magnetometer (microteslas):', x, y, z) + #x, y, z = imu.gyroscope() + #print('Gyroscope (deg/sec):', x, y, z) + #x, y, z = imu.linear_acceleration() + #print('Linear acceleration (m/s^2)', x, y, z) + #x, y, z = imu.gravity() + #print('Gravity (m/s^2):', x, y, z) + time.sleep(100)