@@ -574,7 +574,7 @@ while (True):
574574
575575### Sensors
576576
577- #### IMU (Rev1: LSM9DS1 / Rev2: BMI270 + BMM150)
577+ #### IMU (LSM9DS1, BMI270 + BMM150)
578578
579579Access the ` accelerometer ` , ` magnetometer ` , and ` gyroscope ` data from the IMU module.
580580
@@ -768,25 +768,24 @@ while (True):
768768
769769There are several sensors onboard the Nano 33 BLE Sense. The scripts below can be used to access the data from each of them.
770770
771- #### IMU (LSM9DS1)
771+ #### IMU (LSM9DS1, BMI270 + BMM150 )
772772
773- Access the ` accelerometer ` , ` magnetometer ` , and ` gyroscope ` data from the LSM9DS1 IMU module.
773+ Access the ` accelerometer ` , ` magnetometer ` , and ` gyroscope ` data from the IMU module.
774774
775775``` python
776776import time
777- import lsm9ds1
777+ import imu
778778from machine import Pin, I2C
779779
780780bus = I2C(1 , scl = Pin(15 ), sda = Pin(14 ))
781- lsm = lsm9ds1.LSM9DS1 (bus)
781+ imu = imu.IMU (bus)
782782
783783while (True ):
784- # for g,a in lsm.iter_accel_gyro(): print(g,a) # using fifo
785- print (' Accelerometer: x:{:>8.3f } y:{:>8.3f } z:{:>8.3f } ' .format(* lsm.read_accel()))
786- print (' Magnetometer: x:{:>8.3f } y:{:>8.3f } z:{:>8.3f } ' .format(* lsm.read_magnet()))
787- print (' Gyroscope: x:{:>8.3f } y:{:>8.3f } z:{:>8.3f } ' .format(* lsm.read_gyro()))
784+ print (' Accelerometer: x:{:>8.3f } y:{:>8.3f } z:{:>8.3f } ' .format(* imu.accel()))
785+ print (' Gyroscope: x:{:>8.3f } y:{:>8.3f } z:{:>8.3f } ' .format(* imu.gyro()))
786+ print (' Magnetometer: x:{:>8.3f } y:{:>8.3f } z:{:>8.3f } ' .format(* imu.magnet()))
788787 print (" " )
789- time.sleep_ms(500 )
788+ time.sleep_ms(100 )
790789```
791790
792791
0 commit comments