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.
    >>>
    >>>
    

    0_1539808713383_main.py



  • @robert-hh

    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 looks like line 9 should start with:
    i2c = I2C(0, ........
    And then in the next line i2c instead of I2C has to be used.


 

Hello World?

Pylife on Kickstarter - November 2018








Back Us On Kickstarter >

Pycom on Twitter