Ich habe gesehen, dass nRF52840 Probleme damit hat, den Beschleunigungsmesser und das Gyroskop für die Air Mouse zum LauPython

Python-Programme
Guest
 Ich habe gesehen, dass nRF52840 Probleme damit hat, den Beschleunigungsmesser und das Gyroskop für die Air Mouse zum Lau

Post by Guest »

Ich versuche, eine einfache Gyro/Accel-Air-Maus aus einem Seeed nRF52840 zu bauen. Ich habe viele verschiedene Möglichkeiten ausprobiert, aber mein aktuelles Setup/Problem ist folgendes.

Code: Select all

Error:
Initializing sensor...
Failed to initialize sensor: cannot create 'Pin' instances
Traceback (most recent call last):
File "code.py", line 48, in 
TypeError: cannot create 'Pin' instances
Code:

Code: Select all

print("Initializing sensor...")
try:
scl_pin = Pin(board.SCL)
sda_pin = Pin(board.SDA)

scl_pin.pull = Pin.PULL_UP
sda_pin.pull = Pin.PULL_UP

print("I2C pins configured with pull-ups")

i2c = busio.I2C(board.SCL, board.SDA, frequency=100000)

timeout = time.monotonic() + 5
while not i2c.try_lock() and time.monotonic() < timeout:
pass

if time.monotonic() >= timeout:
raise RuntimeError("Failed to lock I2C bus")

print("Scanning I2C bus...")
devices = i2c.scan()
print("Found devices at:", [hex(x) for x in devices])
i2c.unlock()

if not devices:
raise RuntimeError("No I2C devices found")

sensor = adafruit_lsm6ds.lsm6ds33.LSM6DS33(i2c)
print("Sensor initialized successfully")

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post