@@ -574,7 +574,7 @@ while (True):
574
574
575
575
### Sensors
576
576
577
- #### IMU (Rev1: LSM9DS1 / Rev2: BMI270 + BMM150)
577
+ #### IMU (LSM9DS1, BMI270 + BMM150)
578
578
579
579
Access the ` accelerometer ` , ` magnetometer ` , and ` gyroscope ` data from the IMU module.
580
580
@@ -768,25 +768,24 @@ while (True):
768
768
769
769
There are several sensors onboard the Nano 33 BLE Sense. The scripts below can be used to access the data from each of them.
770
770
771
- #### IMU (LSM9DS1)
771
+ #### IMU (LSM9DS1, BMI270 + BMM150 )
772
772
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.
774
774
775
775
``` python
776
776
import time
777
- import lsm9ds1
777
+ import imu
778
778
from machine import Pin, I2C
779
779
780
780
bus = I2C(1 , scl = Pin(15 ), sda = Pin(14 ))
781
- lsm = lsm9ds1.LSM9DS1 (bus)
781
+ imu = imu.IMU (bus)
782
782
783
783
while (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()))
788
787
print (" " )
789
- time.sleep_ms(500 )
788
+ time.sleep_ms(100 )
790
789
```
791
790
792
791
0 commit comments