PyMaOrb: Python module for LK204-25-USB displays
Posted: Sun Jun 27, 2010 11:05 pm
Here is a Python module for communicating with LK204-25-USB display (and compatible displays?). Read the source before using, along with your display's manual. It uses the pyserial library. Event if it doesn't work with your display model, the source should give you an idea of how you can program your display using Python.
Linux/Windows example:Example for creating custom characters for startup screen:
Don't run this, or it will replace the original startup characters!Example medium and large numbers:
I have not had the chance to test it on other displays, and also some functions are missing, like 1-Wire and some Data security. (they are there, just pass'ed)
It's licensed cc by-nc-sa.
Hope you find it useful and any feedback is appreciated! Sorry for typos, missing comments and such! cheers!
- Morten
Linux/Windows example:
Code: Select all
#!/usr/bin/python
# -*- coding: utf-8 -*-
import PyMaOrb
DISPLAY = PyMaOrb.LCDDisplay('/dev/ttyUSB0',19200)
# i.e DISPLAY = PyMaOrb.LCDDisplay(2,19200) , on windows, where 2 is the comport
DISPLAY.ClearScreen()
DISPLAY.Write("Wake up Neo...")
print "Display version is: "+ str( DISPLAY.ReadVersionNumber() )
Don't run this, or it will replace the original startup characters!
Code: Select all
## Create the characters for a small startup logo shaped like a flame on a stick thingy
#DISPLAY.SaveStartupScreenCustomCharacters(0, ('00100','00000','00000','00000','00000','00010','00000','00001'))
#DISPLAY.SaveStartupScreenCustomCharacters(1, ('00011','00111','01110','01100','01110','00100','00011','00001'))
#DISPLAY.SaveStartupScreenCustomCharacters(2, ('00100','00110','00110','01110','01011','11010','10110','10111'))
#DISPLAY.SaveStartupScreenCustomCharacters(3, ('11110','11110','11110','11110','10111','01111','01111','11111'))
#DISPLAY.SaveStartupScreenCustomCharacters(4, ('10000','00000','00010','00000','00000','10000','01000','01100'))
#DISPLAY.SaveStartupScreenCustomCharacters(5, ('10110','11010','01010','10010','10100','11000','10000','00000'))
#DISPLAY.SaveStartupScreenCustomCharacters(6, ('11111','11111','00000','00000','00000','00000','00000','00000'))
#DISPLAY.SaveStartupScreenCustomCharacters(7, ('00000','00000','00000','01000','00000','00000','00000','00100'))
## Create startup screen
#DISPLAY.ChangeStartupScreen(" "+chr(7)+" Morten's "+ chr(0) + chr(2) + chr(4) +" Brannmur "+ chr(1) + chr(3) + chr(5)+" "+chr(6)*5+" ")
Code: Select all
DISPLAY.InitializeMediumDigits()
DISPLAY.PlaceMediumDigit(1,2,2) # place a medium size digit "1" in row 2 column 2
DISPLAY.InitializeLargeDigits()
DISPLAY.PlaceLargeDigit(2,1) # place a large digit "2" in column 1
It's licensed cc by-nc-sa.
Hope you find it useful and any feedback is appreciated! Sorry for typos, missing comments and such! cheers!

- Morten