Python Modules for the Servo, Relay, and OLED Expansions!
Remove all preinstalled python packages for Oled, Pwm or Relay
And Just do
opkg install pyOledExp rm /usr/lib/python2.7/OmegaExpansion/__init__.py opkg install pyPwmExp
it seems to work for me : no errors when importing in python
Python 2.7.9 (default, Sep 9 2015, 07:59:02) [GCC 4.8.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. import OmegaExpansion.pwmExp as pwm import OmegaExpansion.oledExp as oled
so i've done
#!/usr/bin/python import OmegaExpansion.pwmExp as pwm import OmegaExpansion.oledExp as oled #TEST OLED SCREEN FROM PYTHON oled.driverInit(); oled.setDisplayPower(1) oled.setDisplayMode(1)
The oled screen becomes white !!!
@Daniel-Wright ok, i'll have to look into that! I'll let you know when it's resolved
There's a new package called pyOmegaExpansion that will create the
/usr/lib/python2.7/OmegaExpansion/__init__.pyfile, so there won't be any collisions between the packages
Thank you @Lazar-Demin. I'll check it out.
Enjoy Omega !!!
I finally got around to hooking up the OLED screen and playing around with it. I created a small, Python program to write a simple message to the screen. First, there are some random bits set on the right edge of the screen. Is this a hardware problem or a problem with the Python clear()?
#!/usr/bin/python import OmegaExpansion.oledExp as oled oled.driverInit() oled.setDisplayPower(1) oled.setDisplayMode(0) oled.clear() oled.setCursor(0, 0) oled.write("Hello") oled.setCursor(2,0) oled.write("World!")
Produces the following screen:
So is there a way to get rid of the pixels that are lit up?
Is there a way to write individual bytes (from Python) to produce my own characters?
Hi @Bryan-Hilterbrand, this problem should have been fixed a couple of weeks ago. Can you upgrade your Omega to the latest firmware with
Thanks @Boken-Lin! That fixed the garbage along the right side of the screen.
Now is there any chance I can get an interface to write a byte to an individual column and page? Extra credit if I can read the byte that is currently there! :)
@Bryan-Hilterbrand Ah, unfortunately we cannot read from the OLED via I2C. The closest thing we might be able to do is to keep track of the information that's on the screen in a variable and dump the variable out on demand. But this could back fire if you first print some text, and then upload a transparent image. On the screen you will see both the text and the image but in the memory buffer you would see only the image.
@Boken-Lin no problem on reading, but I'd still like a way to send a byte (or a list of bytes) to the screen. That would allow me to make my own fonts, special characters, or images to send to the OLED screen.
@Bryan-Hilterbrand Ok, I'll look into adding that feature in.
I'll let you know when its available
Thank you @Lazar-Demin!
The OLED Expansion library now supports writing individual bytes, along with some other features!
Check out the details here: https://community.onion.io/topic/560/python-module-for-i2c-oled-library-update
Hey @Lazar-Demin did you see my other post? The python library is seg faulting on setting pixel column, and the doc has typos in it.
@PK-Shiu Yep, there's two responses waiting for you in that thread.