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 col_list = ('red','green','blue','yellow','magenta','orange','pink','violet','cyan','white') #ini variables sel_col = random.randint(0,9) # pick a random start colour sel_col_tmp = 10 # temp colour variable used to avoid repeats
else: ampm("AM") return #------------------------------------ # Main # Initialise display and backlite PiLCD.lcd_init() PiLCD.start_PWM() #turn on backlight PiLCD.led_set_colour('white') # Setup user Characters for display PiLCD.lcd_overchar_setup() #Make sure display is inialised to recieve charater data PiLCD.lcd_setcursor(1,1) count = 0 # temp count variable # initial set of the AM / PM indicator if int(datetime.now().strftime('%H')) >= 12: ampm("PM") else: ampm("AM")