Using i2C SSD1306
-
I am learning how to use the new board. Debugging is a lot easier using an LCD so I am trying to use the attached code with an SSD1306 but I am getting the error below. I would appreciate finding out how to fix this or if there is a simple program showing how to use an I2C LCD that would be also great.
Thanks in advance.
Running c:\Users\ttc\Desktop\Pycom Code\main.py >>> >>> ♦Traceback (most recent call last): File "<stdin>", line 11, in <module> File "/flash/lib/ssd1306.py", line 117, in __init__ File "/flash/lib/ssd1306.py", line 37, in __init__ File "/flash/lib/ssd1306.py", line 62, in init_display File "/flash/lib/ssd1306.py", line 122, in write_cmd TypeError: argument has wrong type ♦> Pycom MicroPython 1.18.1.r1 [v1.8.6-849-b0520f1] on 2018-08-29; WiPy with ESP32 Type "help()" for more information. >>> >>> -
@jimmie looks like line 9 should start with:
i2c = I2C(0, ........
And then in the next line i2c instead of I2C has to be used. -
Thank you @robert-hh .
changed to the code below and it now works.
i2c = I2C(0, I2C.MASTER, baudrate=100000, pins=("P9","P10")) oled = ssd1306.SSD1306_I2C(128, 32, i2c) -
@jimmie hey, did you manage to make it work? Because when I launch a quite similar piece of code to display things on screen, I got the following mistake :
Traceback (most recent call last):
File "<stdin>", line 133, in <module>
File "<stdin>", line 112, in init
File "<stdin>", line 40, in init
File "<stdin>", line 67, in init_display
File "<stdin>", line 92, in show
File "<stdin>", line 122, in write_data
AttributeError: 'I2C' object has no attribute 'start'I use the ssd1306.py as described on this link : https://github.com/pycom/pycom-micropython-sigfox/blob/master/drivers/display/ssd1306.py.
-
@brossingo Change the method write_data() in class class SSD1306_I2C(SSD1306) to:
def hw_write_data(self, buf): self.i2c.writeto(self.addr, b'\x40'+buf)The code in that lib is for the micropython.org branch and was never ported.
-
@brossingo FWIW, I managed to get such a display running with the development release firmware (version 1.20rc4) in combination with the
write_data()change that robert-hh mentioned. This newer release is required in order to be able to make use theframebufclass.Here's a post with my notes: https://forum.pycom.io/post/24819
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login