User manual

Ausgabe 10.11.2017 Copyright by Joy-IT 8
3
def GotoLine(row):
#Moves cursor to the given row
#Expects row values 0-1 for 16x2 display; 0-3 for 20x4 display
addr = LINE[row]
SendByte(SETCURSOR+addr)
########################################################################
# Main Program
print "LCD program starting. Press CTRL+C to stop."
InitIO()
InitLCD()
ShowMessage('Press a button!')
while (True):
GotoLine(1)
switchValues = CheckSwitches()
decimalResult = " %d %d %d %d" % switchValues
ShowMessage(decimalResult)
# time.sleep(0.2)
You can save the le by pressing CTRL+O and leave the editor by pressing CTRL+X.
You can start the program with the following command:
sudo python lcd20x4.py
LCD Display 20x4 with Buttons