Pinnache
Pinnache

Reputation: 11

"OSError: [Errno 5] EIO" when running my code

Error:

>>> %Run -c $EDITOR_CONTENT
Traceback (most recent call last):
  File "<stdin>", line 5, in <module>
  File "/lib/ssd1306.py", line 110, in __init__
  File "/lib/ssd1306.py", line 36, in __init__
  File "/lib/ssd1306.py", line 71, in init_display
  File "/lib/ssd1306.py", line 115, in write_cmd
OSError: [Errno 5] EIO

My script:

from machine import Pin, I2C
from ssd1306 import SSD1306_I2C

i2c = I2C(0, sda=Pin(16), scl=Pin(17), freq=40000)
oled = SSD1306_I2C(128, 64, i2c)

oled.fill(0)
oled.text("Hello", 0, 0)
oled.show()
import machine
import ssd1306
import time

# Define the pins for I2C communication
i2c = machine.I2C(0, sda=machine.Pin(16), scl=machine.Pin(17), freq=400000)

# Define the display object
oled = ssd1306.SSD1306_I2C(128, 64, i2c)

# Clear the display
oled.fill(0)
oled.show()

# Display something
oled.text("Hello, Pico!", 0, 0)
oled.show()

What causes the issue?

Upvotes: 1

Views: 1459

Answers (1)

Drumsman
Drumsman

Reputation: 715

I had a similar problem in a raspberry pi pico with a DS3231 real time clock module and I solved it switching the microPython version to RPI_PICO-20231005-v1.21.0.uf2

Source:

Upvotes: 0

Related Questions