Python Module for I2C, OLED Library Update

  • administrators

    I2C Python Module

    Finally, as promised, the Onion I2C library is available as a Python module.

    Check out this wiki post for details on how to install and use the module:

    OLED Expansion Library

    The OLED library has been updated with some new functions:

    • Setting column addressing for text
    • Setting column addressing for the full screen
    • Setting the cursor based on the row and pixel (instead of column)
    • Writing a single byte (8 vertical pixels) to the screen

    The functions are available in the C library as well as the Python Module, and the command line oled-exp tool supports the new functions as well.
    All of the info can be found here:

  • I am go glad you updated the oled python library. HOWEVER:

    1. there are typos in the wiki: the python method is not oledSetImageColumns() , it is just setImageColumns()

    (one can check by doing a dir on the module)

    1. more importantly, when I call setCursorByPixel(0,0) I get a seg fault.

    Please fix these bugs ! I am writing a library to write scalable font to the display and need byte level writes to work.


  • administrators

    @PK-Shiu Ah apologies for the typos, the wiki article has been updated.

    And I'll take a loot at the segfault tomorrow!

  • administrators

    It works fine on my end, I think that the segfault issue is due to the libonionoledexp library not being the latest version.

    Can you run opkg list-installed | grep -i oled?
    All of the versions should be 0.2-1

    If that's the case, run the following:

    opkg upgrade pyOledExp --force-depends

    This will update the pyOledExp package and all of it's dependencies to the latest version. Try running your code again and let me know how it goes.

  • Not only did I have to force my Onion to update the Python OLED library, I also had to force it to update the C library:

    opkg upgrade libonionoledexp --force-depends

  • Thank you, @Lazar-Demin, it appears to be working great!

    Here's my test program for those who are interested.

    import OmegaExpansion.oledExp as oled
    oled.setCursorByPixel(0, 0)

    I'm ignoring the status return from writeByte (and probably a few other API's too). The output should be a tiny face on the OLED. I tried to do a smiley, but there wasn't enough space in an 8x8 block


  • Thanks @Bryan-Hilterbrand and @Lazar-Demin - I have to update both libraries. Now it is working. BTW this is my package list:

    libonionoledexp - 0.2-1
    oled-exp - 0.1-1
    pyOledExp - 0.2-1

    oled-exp is still at 0.1.-1.


  • @PK-Shiu, you're right, oled-exp should be updated as well. oled-exp is the command line tool for accessing the OLED screen, so it doesn't matter when you're using Python.

    opkg upgrade oled-exp --force-depends

  • administrators

    Nice! Here's your test program on my Omega at the office:
    oled smiley

Looks like your connection to Onion Community was lost, please wait while we try to reconnect.