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 step_time = .4 # scroll step time, seems to work down to .1 on a Pi 2 PiLCD.mess = tline2 t=Thread(target=PiLCD.lcd_scroll, args=(step_time,2)) t.start()
# Start the scrolling thread t=Thread(target=PiLCD.lcd_scroll, args=(0.6,2)) t.start() while True: # Get the time and date timen = datetime.now().strftime('%a %d %b %H:%M') PiLCD.bflag=True # suspect scrolling while writing other info to display sleep(0.2) PiLCD.lcd_string(timen,1,0) PiLCD.bflag=False # restart scrolling sleep(0.2) # Update RSS feeds approx every 10 minutes if datetime.now().strftime('%M')[1] == '5' and rssup == True: PiLCD.mess = mess_build(subject) print("updating RSS "+timen) rssup = False # stop repeated RSS fetches if datetime.now().strftime('%M')[1] == '0': # reset RSS fetch flag to true rssup = True sleep(10)