예제 #1
0
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

	sleep(0.95)


예제 #2
0
# 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)	

	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