用于esp32的micropython BMI160六轴陀螺仪驱动。用法如下
from machine import Pin, I2C, PWM
from BMI160 import BMI160_I2C
from time import sleep_ms
i2c = I2C(sda=Pin(32), scl=Pin(33))
bmi160 = BMI160_I2C(i2c)
k_angle = 180
angle_x = 0
angle_y = 0
angle_garget = 0
while True:
data = bmi160.getMotion6()
angle_x = data[3] / 32768 * k_angle
print(angle_x)
sleep_ms(1000 // 25)
2022-09-16 11:00:56
13KB
BMI160
1