Example: 50-Arduino-Boards/Nano-RP2040/51-Sensors/lsm6dsox_basic.py

# 本作品采用MIT许可证授权。
# 版权所有 (c) 2013-2023 OpenMV LLC。保留所有权利。
# https://github.com/openmv/openmv/blob/master/LICENSE
#
# LSM6DSOX 基础示例。
import time
from lsm6dsox import LSM6DSOX
from machine import Pin
from machine import I2C

lsm = LSM6DSOX(I2C(0, scl=Pin(13), sda=Pin(12)))
# 或以 SPI 模式初始化。
# lsm = LSM6DSOX(SPI(5), cs=Pin(10))

while True:
    print("Accelerometer: x:{:>8.3f} y:{:>8.3f} z:{:>8.3f}".format(*lsm.accel()))
    print("Gyroscope:     x:{:>8.3f} y:{:>8.3f} z:{:>8.3f}".format(*lsm.gyro()))
    print("")
    time.sleep_ms(100)

results matching ""

    No results matching ""