MicroPython: OSError: [Errno 19] ENODEV
MicroPython: OSError: [Errno 19] ENODEV
我尝试将我的 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)
有人可以帮助我
你说你用三根线连接 GY-91 - VIN、SCL 和 SDA。你没有提到GND。
您必须连接 GND 和 VIN 才能正常工作。使用另一个跳线将 GND 连接到 ESP32 上的 GND,然后重试。
[编辑:Errno 19 ENODEV 表示模块找不到 I2C 传感器]
我尝试将我的 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)
有人可以帮助我
你说你用三根线连接 GY-91 - VIN、SCL 和 SDA。你没有提到GND。
您必须连接 GND 和 VIN 才能正常工作。使用另一个跳线将 GND 连接到 ESP32 上的 GND,然后重试。
[编辑:Errno 19 ENODEV 表示模块找不到 I2C 传感器]