mirror of
https://github.com/openmv/openmv.git
synced 2025-11-04 14:49:50 +08:00
20 lines
634 B
Python
20 lines
634 B
Python
# This work is licensed under the MIT license.
|
|
# Copyright (c) 2013-2023 OpenMV LLC. All rights reserved.
|
|
# https://github.com/openmv/openmv/blob/master/LICENSE
|
|
#
|
|
# IMU example for Arduino Nano BLE 33 Sense (REV1 and REV2).
|
|
|
|
import time
|
|
import imu
|
|
from machine import Pin, I2C
|
|
|
|
bus = I2C(1, scl=Pin(15), sda=Pin(14))
|
|
imu = imu.IMU(bus)
|
|
|
|
while (True):
|
|
print('Accelerometer: x:{:>8.3f} y:{:>8.3f} z:{:>8.3f}'.format(*imu.accel()))
|
|
print('Gyroscope: x:{:>8.3f} y:{:>8.3f} z:{:>8.3f}'.format(*imu.gyro()))
|
|
print('Magnetometer: x:{:>8.3f} y:{:>8.3f} z:{:>8.3f}'.format(*imu.magnet()))
|
|
print("")
|
|
time.sleep_ms(100)
|