@@ -574,25 +574,24 @@ while (True):
574
574
575
575
### Sensors
576
576
577
- #### IMU (LSM9DS1)
577
+ #### IMU (Rev1: LSM9DS1 / Rev2: BMI270 + BMM150 )
578
578
579
- Access the ` accelerometer ` , ` magnetometer ` , and ` gyroscope ` data from the LSM9DS1 IMU module.
579
+ Access the ` accelerometer ` , ` magnetometer ` , and ` gyroscope ` data from the IMU module.
580
580
581
581
``` python
582
582
import time
583
- import lsm9ds1
583
+ import imu
584
584
from machine import Pin, I2C
585
585
586
586
bus = I2C(1 , scl = Pin(15 ), sda = Pin(14 ))
587
- lsm = lsm9ds1.LSM9DS1 (bus)
587
+ imu = imu.IMU (bus)
588
588
589
589
while (True ):
590
- # for g,a in lsm.iter_accel_gyro(): print(g,a) # using fifo
591
- print (' Accelerometer: x:{:>8.3f } y:{:>8.3f } z:{:>8.3f } ' .format(* lsm.read_accel()))
592
- print (' Magnetometer: x:{:>8.3f } y:{:>8.3f } z:{:>8.3f } ' .format(* lsm.read_magnet()))
593
- print (' Gyroscope: x:{:>8.3f } y:{:>8.3f } z:{:>8.3f } ' .format(* lsm.read_gyro()))
590
+ print (' Accelerometer: x:{:>8.3f } y:{:>8.3f } z:{:>8.3f } ' .format(* imu.accel()))
591
+ print (' Gyroscope: x:{:>8.3f } y:{:>8.3f } z:{:>8.3f } ' .format(* imu.gyro()))
592
+ print (' Magnetometer: x:{:>8.3f } y:{:>8.3f } z:{:>8.3f } ' .format(* imu.magnet()))
594
593
print (" " )
595
- time.sleep_ms(500 )
594
+ time.sleep_ms(100 )
596
595
```
597
596
598
597
### Wireless
@@ -1546,4 +1545,4 @@ If you need to stop the audio streaming, you can call `.stop_streaming()`.
1546
1545
1547
1546
``` python
1548
1547
audio.stop_streaming()
1549
- ```
1548
+ ```
0 commit comments