Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 3746beb

Browse files
Update IMU example for Nano 33 BLE Sense
1 parent e182ba9 commit 3746beb

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

‎content/micropython/01.basics/06.board-examples/board-examples.md‎

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,7 @@ while (True):
574574

575575
### Sensors
576576

577-
#### IMU (Rev1: LSM9DS1 / Rev2: BMI270 + BMM150)
577+
#### IMU (LSM9DS1, BMI270 + BMM150)
578578

579579
Access the `accelerometer`, `magnetometer`, and `gyroscope` data from the IMU module.
580580

@@ -768,25 +768,24 @@ while (True):
768768

769769
There 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
776776
import time
777-
import lsm9ds1
777+
import imu
778778
from machine import Pin, I2C
779779

780780
bus = I2C(1, scl=Pin(15), sda=Pin(14))
781-
lsm = lsm9ds1.LSM9DS1(bus)
781+
imu = imu.IMU(bus)
782782

783783
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()))
788787
print("")
789-
time.sleep_ms(500)
788+
time.sleep_ms(100)
790789
```
791790

792791

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /