TroubleshootingGravity

Gravity RGB LED button issue after press button

userHead Lupin 2024-02-09 19:29:43 152 Views1 Replies

Following problem with MicroPython:

 

```python repl

>>> from machine import I2C, Pin

>>> connection = I2C(0, sda=Pin(21), scl=Pin(22))

>>> print(connection.readfrom_mem(0x2a, 0x04, 1))
b'\x00'

>>> print(connection.readfrom_mem(0x2a, 0x04, 1))
b'\x00'

```

 

this works fine till I press the button:

 

```python repl

>>> print(connection.readfrom_mem(0x2a, 0x04, 1))
Traceback (most recent call last):
 File "<stdin>", line 1, in <module>
OSError: [Errno 19] ENODEV

```

 

I tested the RGB LED button already on Raspberry PI (code: https://github.com/DFRobot/DFRobot_RGBButton/tree/main/python/raspberrypi), but as soon I switch to ESP32 with MicroPython, I always end up with same issue. Also, cables and device working fine (tested it and can confirm there is no problem)! 

 

Can someone provide a hint were my problem is?

 

2024-02-09 22:08:54

Okay … can be closed I found the issue! Missed to set frequency like: I2C(0, sda=Pin(21), scl=Pin(22), freq=100000). The default on MicroPython is too high.

userHeadPic Lupin