-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #50 from myllyja/fix-lsm6ds3trc
Fixed LSM6DS3 to LSM6DS3TR-C
- Loading branch information
Showing
2 changed files
with
37 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# SPDX-FileCopyrightText: Copyright (c) 2020 Bryan Siepert for Adafruit Industries | ||
# | ||
# SPDX-License-Identifier: MIT | ||
import time | ||
import board | ||
import digitalio | ||
import busio | ||
from adafruit_lsm6ds.lsm6ds3trc import LSM6DS3TRC | ||
|
||
# On the Seeed XIAO nRF52840 Sense the LSM6DS3TR-C IMU is connected on a separate | ||
# I2C bus and it has its own power pin that we need to enable. | ||
imupwr = digitalio.DigitalInOut(board.IMU_PWR) | ||
imupwr.direction = digitalio.Direction.OUTPUT | ||
imupwr.value = True | ||
|
||
imu_i2c = busio.I2C(board.IMU_SCL, board.IMU_SDA) | ||
sensor = LSM6DS3TRC(imu_i2c) | ||
|
||
while True: | ||
print("Acceleration: X:%.2f, Y: %.2f, Z: %.2f m/s^2" % (sensor.acceleration)) | ||
print("Gyro X:%.2f, Y: %.2f, Z: %.2f radians/s" % (sensor.gyro)) | ||
print("") | ||
time.sleep(0.5) |