I installed micropython v1.18 on a pi pico module.
Attached to the pico I connect a mcp23017.
Using the MCP23017 module from Mike Causer I wrote a small test program that every 500ms turns pin0 on and off.
This works for about 1..2 minutes and then it stops with an error:
Code: Select all
Traceback (most recent call last):
File "<stdin>", line 20, in <module>
File "mcp23017.py", line 405, in output
File "mcp23017.py", line 85, in mode
File "mcp23017.py", line 73, in _read
OSError: [Errno 5] EIO
Win 11 with Thonny 3.3.13 installed
MicroPython v1.18 on 2022-01-17; Raspberry Pi Pico with RP2040
Question of the day : what's going wrong?
Is it my error?
Thanks,
Gunter
Code of test program:
Code: Select all
import time
import mcp23017
from machine import Pin, I2C
# Initialize the I2C bus:
i2c = I2C(1, scl=Pin(3), sda=Pin(2), freq = 100_000)
mcp = mcp23017.MCP23017(i2c, 0x20) # MCP23017
mcp.pin(0, mode = 0)
pin0 = mcp[0]
# Now loop blinking the pin 0 output and reading the state of pin 1 input.
while True:
# Blink pin 0 on and then off.
pin0.output(0)
time.sleep(0.5)
pin0.output(1)
time.sleep(0.5)