Skip to content
This repository was archived by the owner on Sep 30, 2019. It is now read-only.

Commit b8a5ee9

Browse files
author
Your Name
committed
test sketch
1 parent 86670a0 commit b8a5ee9

File tree

1 file changed

+69
-0
lines changed

1 file changed

+69
-0
lines changed

Adafruit_CharLCDPlate/LCDtest.py

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
#!/usr/bin/pythonhttp://raspberrypi.local/editor
2+
3+
#
4+
# based on code from lrvick and LiquidCrystal
5+
# lrvic - https://github.com/lrvick/raspi-hd44780/blob/master/hd44780.py
6+
# LiquidCrystal - https://github.com/arduino/Arduino/blob/master/libraries/LiquidCrystal/LiquidCrystal.cpp
7+
#
8+
9+
from time import sleep
10+
from Adafruit_I2C import Adafruit_I2C
11+
from Adafruit_MCP230xx import Adafruit_MCP230XX
12+
from Adafruit_CharLCDPlate import Adafruit_CharLCD
13+
14+
import smbus
15+
16+
17+
# initialize the LCD (the pins are 'fixed', dont change the numbers!)
18+
19+
lcd = Adafruit_CharLCD(15, 13, [12,11,10,9], 14)
20+
# clear display
21+
lcd.clear()
22+
# hello!
23+
lcd.message("Adafruit RGB LCD\nPlate w/Keypad!")
24+
sleep(1)
25+
26+
# first loop, just changes the color
27+
lcd.backlight(lcd.RED)
28+
sleep(.5)
29+
lcd.backlight(lcd.YELLOW)
30+
sleep(.5)
31+
lcd.backlight(lcd.GREEN)
32+
sleep(.5)
33+
lcd.backlight(lcd.TEAL)
34+
sleep(.5)
35+
lcd.backlight(lcd.BLUE)
36+
sleep(.5)
37+
lcd.backlight(lcd.VIOLET)
38+
sleep(.5)
39+
lcd.backlight(lcd.ON)
40+
sleep(.5)
41+
lcd.backlight(lcd.OFF)
42+
sleep(.5)
43+
44+
while 1:
45+
if (lcd.buttonPressed(lcd.LEFT)):
46+
lcd.clear()
47+
lcd.message("Red Red Wine")
48+
lcd.backlight(lcd.RED)
49+
50+
if (lcd.buttonPressed(lcd.UP)):
51+
lcd.clear()
52+
lcd.message("Sita Sings \nthe blues")
53+
lcd.backlight(lcd.BLUE)
54+
55+
if (lcd.buttonPressed(lcd.DOWN)):
56+
lcd.clear()
57+
lcd.message("I see fields\nof green");
58+
lcd.backlight(lcd.GREEN)
59+
60+
if (lcd.buttonPressed(lcd.RIGHT)):
61+
lcd.clear()
62+
lcd.message("Purple mountain\n majesties");
63+
lcd.backlight(lcd.VIOLET)
64+
65+
if (lcd.buttonPressed(lcd.SELECT)):
66+
lcd.clear()
67+
lcd.backlight(lcd.ON)
68+
69+

0 commit comments

Comments
 (0)