I've been trying to use an ssd1306 oled display with a raspberry pi pico but every time I run the code it returns an error. I don't know what the error means and can't really find anything online for it. I was able to "fix" it yesterday by changing the address in the library file it uses, but although it worked, the issue came back for no apparent reason, despite me not even changing any of the code.
this is the code that I am trying to use
from machine import Pin, I2C from ssd1306 import SSD1306_I2C i2c=I2C(0,sda=Pin(0), scl=Pin(1), freq=400000) oled = SSD1306_I2C(128, 64, i2c) oled.text("hello world", 0, 0) oled.show()
this is the error
Traceback (most recent call last): File "<stdin>", line 11, 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
and the 'addr=0x3D' was originally 0x3C which is 60 in hex but since my i2c.scan returned 61, I changed it to 0x3D, which fixed it for a little bit but it stopped working again for some reason
class SSD1306_I2C(SSD1306): def __init__(self, width, height, i2c, addr=0x3D, external_vcc=False): self.i2c = i2c self.addr = addr self.temp = bytearray(2) self.write_list = [b"\x40", None] # Co=0, D/C#=1 super().__init__(width, height, external_vcc)