# basic code to test sub-routine class import time from time import sleep import random import datetime from datetime import datetime from threading import Thread random.seed() # setup seed based on system time from DMS_PiLCD1 import DMS_PiLCD PiLCD=DMS_PiLCD() # Initialise display and backlite PiLCD.lcd_init() PiLCD.start_PWM() #turn on backlight PiLCD.led_set_colour('white') #led_set(40,0,0) # Send some test text tline1 = "**Raspberry Pi**" tline2 = "16x2 LCD Test" PiLCD.lcd_string(tline1,1,0) #setup list of colours
# http://meanderingpi.wordpress.com # # [insprired / based on work by Matt Hawkins http://www.raspberrypi-spy.co.uk/] # # Import import RPi.GPIO as GPIO import time from time import sleep import datetime from datetime import datetime # Setup access to PiLCD class from DMS_PiLCD1 import DMS_PiLCD PiLCD=DMS_PiLCD() # Local LCD update routine def uplcd(): if col == 1: colt = "Red" elif col == 2: colt = "Green" elif col == 3: colt = "Blue" PiLCD.lcd_cls(True) PiLCD.lcd_string(colt+" Selected",1,0) if rl == 100: rt = "FP"
# Import import RPi.GPIO as GPIO import time from time import sleep import datetime from datetime import datetime from threading import Thread import feedparser # needs to be installed first with "sudo pip install feedparser" # or xxxxx for python 3 #setup PiLCD Class access from DMS_PiLCD1 import DMS_PiLCD PiLCD=DMS_PiLCD() #------------------------------------------ # BBC RSS feed functions # get rss text with handling for an IO exception def getrss(subject): #get rss, handle Indexerror - ie if it cannot find the site #for anyother error kill the program safely msg="X X X X X" try: msg = feedparser.parse('http://feeds.bbci.co.uk/news/'+subject+'/rss.xml?edition=uk').entries[0].title except IndexError: msg = "data error" except:
# # Developement script for Pi_lcd project # # #import import RPi.GPIO as GPIO import time from time import sleep import random import datetime from datetime import datetime from DMS_PiLCD1 import DMS_PiLCD PiLCD=DMS_PiLCD() random.seed() # setup seed based on system time #display / update AM-PM indicator def ampm(morn_eve): if morn_eve == "PM": PiLCD.lcd_setcursor(14,2) PiLCD.lcd_char(ord('P')) PiLCD.lcd_char(ord('M')) else: PiLCD.lcd_setcursor(14,2) PiLCD.lcd_char(ord('A')) PiLCD.lcd_char(ord('M'))