SH1106/I2C OLED driver on pyboard
Posted: Wed Mar 09, 2022 9:19 pm
I am trying to use an SH1106 OLED connected by I2C to a pyboard. The OLED is a 1.3" 128x64 module I purchased from amazon
(https://smile.amazon.com/gp/product/B07 ... UTF8&psc=1). I am using the driver I found at https://github.com/scy/SH1106. I am running a slightly modified version of the example code posted with the driver:
from machine import Pin, I2C
import sh1106
#
i2c = I2C(scl=Pin('X9'), sda=Pin('X10'), freq=400000)
display = sh1106.SH1106_I2C(128, 64, i2c, None, 0x3c)
display.sleep(False)
display.fill(0)
display.text('Testing 1', 0, 0, 1)
display.show()
When I run this, get the following error message:
Warning: I2C(-1, ...) is deprecated, use SoftI2C(...) instead
Traceback (most recent call last):
File "<stdin>", line 5, in <module>
File "sh1106.py", line 173, in __init__
File "sh1106.py", line 111, in __init__
File "sh1106.py", line 116, in init_display
File "sh1106.py", line 123, in poweron
File "sh1106.py", line 178, in write_cmd
OSError: [Errno 19] ENODEV
I get the same error if I used SoftI2C instead of the hardware I2C. I think the problem may be in the recent I2C implementation on the pyboard; I get a similar error when trying to use a ssd1306 on a different OLED. Any suggestions are welcome.
(https://smile.amazon.com/gp/product/B07 ... UTF8&psc=1). I am using the driver I found at https://github.com/scy/SH1106. I am running a slightly modified version of the example code posted with the driver:
from machine import Pin, I2C
import sh1106
#
i2c = I2C(scl=Pin('X9'), sda=Pin('X10'), freq=400000)
display = sh1106.SH1106_I2C(128, 64, i2c, None, 0x3c)
display.sleep(False)
display.fill(0)
display.text('Testing 1', 0, 0, 1)
display.show()
When I run this, get the following error message:
Warning: I2C(-1, ...) is deprecated, use SoftI2C(...) instead
Traceback (most recent call last):
File "<stdin>", line 5, in <module>
File "sh1106.py", line 173, in __init__
File "sh1106.py", line 111, in __init__
File "sh1106.py", line 116, in init_display
File "sh1106.py", line 123, in poweron
File "sh1106.py", line 178, in write_cmd
OSError: [Errno 19] ENODEV
I get the same error if I used SoftI2C instead of the hardware I2C. I think the problem may be in the recent I2C implementation on the pyboard; I get a similar error when trying to use a ssd1306 on a different OLED. Any suggestions are welcome.