【得捷电子Follow me第1期】 OLED显示报错
[复制链接]
大家好,我用tonny开发OLED显示屏,我将ssd1306.py传到我的板子上,如下图。
然后参考网友的OLED驱动代码,实际就是i2c协议加上ssd1306驱动,我尝试i2c0和1接口,报错都是一样,换屏幕也还是一样。
oled代码如下:
from machine import Pin,I2C
from ssd1306 import SSD1306_I2C
import time
#i2c=machine.I2C(1, sda=Pin(6), scl=Pin(7), freq=400000)
#i2c = I2C(0, sda=Pin(8), scl=Pin(9), freq=400000)
i2c = I2C(1, sda=Pin(6), scl=Pin(7), freq=400000)
#i2c = I2C(1, sda=Pin("GP18"), scl=Pin("GP19"), freq=400000)
#print(i2c.scan())
display = SSD1306_I2C(128, 64, i2c)
display.fill(0)
display.show()
display.text("1",5,10)
display.show()
报错如下:
Traceback (most recent call last):
File "<stdin>", line 10, in <module>
File "ssd1306.py", line 110, in __init__
File "ssd1306.py", line 36, in __init__
File "ssd1306.py", line 71, in init_display
File "ssd1306.py", line 115, in write_cmd
OSError: [Errno 5] EIO
两个OLED都试过,如下:
请问应该怎么解决呢?
|