# 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() while True: PiLCD.mess=input("New message to display ?") PiLCD.bflag=True sleep(.2) while sel_col == sel_col_tmp: sel_col = random.randint(0,9) sel_col_tmp = sel_col PiLCD.led_set_colour(col_list[sel_col]) PiLCD.bflag=False
# Turn on backlight # Set colour as magenta ish PiLCD.led_set(100,0,100) # setup RSS info for BBC website # Define rss list - format is 'exact rss title','meaningful title' # Each list entry is in 2 parts firstly the exact RSS search string for the BBC site # then the title to display subject=['world','World','uk','UK','politics','Politics','entertainment_and_arts','Ent'] # 'technology','Tech', # other RSS options on BBC site # Setup inital message so mess is defined on first pass through 'while' loop PiLCD.mess = mess_build(subject) rssup = True # avoid missing first update slot # 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)