我尝试将我的ESP32连接到一个传感器GY91(MPU9250 + BMP280)。 我正在使用这个库:https://github.com/tuupola/micropython-mpu9250
我使用了示例代码:
import utime
from machine import I2C, Pin
from mpu9250 import MPU9250
i2c = I2C(scl=Pin(22), sda=Pin(21))
sensor = MPU9250(i2c)
print("MPU9250 id: " + hex(sensor.whoami))
while True:
print(sensor.acceleration)
print(sensor.gyro)
print(sensor.magnetic)
print(sensor.temperature)
utime.sleep_ms(1000)
我将库(mpu6500、mpu9250、ak8963)导入到我的ESP32设备中。 但是当我开始运行代码时,遇到了这个错误:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<string>", line 8, in <module>
File "mpu9250.py", line 45, in __init__
File "mpu6500.py", line 97, in __init__
File "mpu6500.py", line 149, in whoami
File "mpu6500.py", line 181, in _register_char
OSError: [Errno 19] ENODEV
我用来编写MicroPython的软件是uPyCraft,我也使用Thonny。 硬件是ESP32和传感器GY-91(我通过3根电缆连接,Vin(传感器)连接到5V,SCL连接到引脚22,SDA连接到引脚21)。
请有人帮帮我。