-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_ada_lcd.py
executable file
·48 lines (40 loc) · 1.15 KB
/
test_ada_lcd.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env python
# -*- coding: latin-1 -*-
# Test program for the Adafruit Plate
# $Id: test_ada_lcd.py,v 1.4 2014/03/25 19:42:00 bob Exp $
#
# License: GNU V3, See https://www.gnu.org/copyleft/gpl.html
#
# Disclaimer: Software is provided as is and absolutly no warranties are implied or given.
# The authors shall not be liable for any loss or damage however caused.
#
import atexit
from time import sleep
from ada_lcd_class import Adafruit_lcd
lcd = Adafruit_lcd()
def interrupt():
return False
def finish():
lcd.clear()
lcd.line1("Finished")
atexit.register(finish)
lcd.setWidth(16)
lcd.line1("Test Adafruit")
lcd.scroll2("Line 2: abcdefghijklmnopqrstuvwxyz 0123456789",interrupt)
lcd.line1("Try buttons")
while True:
if lcd.buttonPressed(lcd.MENU):
print("Menu button")
lcd.line2("Menu button")
elif lcd.buttonPressed(lcd.LEFT):
print("Left button")
lcd.line2("Left button")
elif lcd.buttonPressed(lcd.RIGHT):
print("Right button")
lcd.line2("Right button")
elif lcd.buttonPressed(lcd.UP):
print("Up button")
lcd.line2("Up button")
elif lcd.buttonPressed(lcd.DOWN):
print("Down button")
lcd.line2("Down button")