Created
September 27, 2013 18:31
-
-
Save adammelancon/6733055 to your computer and use it in GitHub Desktop.
Found it here https://github.com/paulkoorn/test/blob/56a98edbec5942c9cb2408c8f54b2a1015171ea8/lcdscroll.py
figured I could use it soon.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin python | |
import sys | |
sys.path.append("/home/pi/git/Adafruit-Raspberry-Pi-Python-Code/Adafruit_CharLCDPlate") | |
from Adafruit_CharLCDPlate import Adafruit_CharLCDPlate | |
from time import sleep | |
lcd = Adafruit_CharLCDPlate() | |
str_pad = " " * 16 | |
my_long_string = "this is a string that needs to scroll" | |
my_long_string = str_pad + my_long_string | |
def Scroll(): | |
lcd.clear() | |
for i in range (0, len(my_long_string)): | |
lcd_text = my_long_string[i:(i+15)] | |
print lcd_text | |
print i | |
lcd.backlight(lcd.ON) | |
lcd.message(lcd_text) | |
sleep(0.4) | |
Scroll() | |
while True: | |
try: | |
Scroll() | |
except KeyboardInterrupt: | |
print "\nclean exit" | |
lcd.clear() | |
lcd.backlight(lcd.OFF) | |
exit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment