jdhxyy / ssd1306py-micropython

ssd1306 driver for micropython
MIT License
47 stars 10 forks source link

[rpi pico Micropython v1.19.1 (2022-06-18)] Not working #4

Open kittenarmy opened 1 year ago

kittenarmy commented 1 year ago

I am using Micropython rp2-pico-20220618-v1.19.1.uf2 on Raspberry Pi Pico. I installed ssd1306py to /lib in Thonny.

The example code:

import ssd1306py as lcd
# init_i2c(scl, sda, width, height, i2c)
lcd.init_i2c(1, 0, 128, 64, 0)
# lcd.text('font8x8', 0, 0, 8)
lcd.text('font16x16', 0, 20, 16)
lcd.show()

gives an error in Thonny:

>>> %Run -c $EDITOR_CONTENT
Traceback (most recent call last):
  File "<stdin>", line 13, in <module>
  File "/lib/ssd1306py/ops.py", line 66, in text
  File "/lib/ssd1306py/ascii16.py", line 34, in display
  File "/lib/ssd1306py/ascii16.py", line 15, in _get_ch
OSError: [Errno 2] ENOENT
>>> 

I tried the fixes suggested in this thread, changing _file.seek(ord(ch) * 86) to _file.seek(ord(ch) * 85) but same errors as before.

frankisme commented 1 year ago

ascii16.py, line 15,“_file = open(sys.path[1]” to “_file = open(sys.path[2]”. Try

longczx commented 1 year ago

In fact, you need to modify two places

1:ascii16.py, line 15,“_file = open(sys.path[1]” to “_file = open(sys.path[2]”. Try

2: file.seek(ord(ch) * 86) to file.seek(ord(ch) * 85)