diff --git a/content/micropython/01.basics/06.board-examples/board-examples.md b/content/micropython/01.basics/06.board-examples/board-examples.md index 041ee1013d..bd301efaa2 100644 --- a/content/micropython/01.basics/06.board-examples/board-examples.md +++ b/content/micropython/01.basics/06.board-examples/board-examples.md @@ -574,7 +574,7 @@ while (True): ### Sensors -#### IMU (Rev1: LSM9DS1 / Rev2: BMI270 + BMM150) +#### IMU (LSM9DS1, BMI270 + BMM150) Access the `accelerometer`, `magnetometer`, and `gyroscope` data from the IMU module. @@ -768,25 +768,24 @@ while (True): There are several sensors onboard the Nano 33 BLE Sense. The scripts below can be used to access the data from each of them. -#### IMU (LSM9DS1) +#### IMU (LSM9DS1, BMI270 + BMM150) -Access the `accelerometer`, `magnetometer`, and `gyroscope` data from the LSM9DS1 IMU module. +Access the `accelerometer`, `magnetometer`, and `gyroscope` data from the IMU module. ```python import time -import lsm9ds1 +import imu from machine import Pin, I2C bus = I2C(1, scl=Pin(15), sda=Pin(14)) -lsm = lsm9ds1.LSM9DS1(bus) +imu = imu.IMU(bus) while (True): - #for g,a in lsm.iter_accel_gyro(): print(g,a) # using fifo - print('Accelerometer: x:{:>8.3f} y:{:>8.3f} z:{:>8.3f}'.format(*lsm.read_accel())) - print('Magnetometer: x:{:>8.3f} y:{:>8.3f} z:{:>8.3f}'.format(*lsm.read_magnet())) - print('Gyroscope: x:{:>8.3f} y:{:>8.3f} z:{:>8.3f}'.format(*lsm.read_gyro())) + 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(500) + time.sleep_ms(100) ```