Exemplo n.º 1
0
boardrevision = 2
stderr("Are you using an old revision 1 board y/n: ")
answer = raw_input("")
if answer == 'y':
	boardrevision = 1

print "Use Ctl-C to exit"

lcd.init(boardrevision)
width = lcd.getWidth()
if width is 0:
	print "Set the lcd_width parameter in /etc/radiod.conf"
	sys.exit(1)

lcd.setWidth(width)
lcd.line1("Bob Rathbone")

while True:
	try:
		lcd.line3("Line 3")
		lcd.line4("Line 4")
		lcd.scroll2("Line 2: abcdefghijklmnopqrstuvwxyz 0123456789",interrupt) 
	except KeyboardInterrupt:
		print "\nExit"
		GPIO.setwarnings(False)
		GPIO.cleanup()
		sys.exit(0)

# End of test program
Exemplo n.º 2
0
time_stamp = time.time()
time_now = time_stamp
def exec_cmd(cmd): 
	p = os.popen(cmd)
	result = ""
	while p.readline():
	        result = result + p.readline()
#.rstrip('\n')
        return result

number = 0
lcd.init() 
todaysdate = strftime("%H:%M %d/%m/%Y") 
ipaddr = exec_cmd('hostname -I') 
lcd.line1(str(todaysdate)) 
lcd.line2(ipaddr) 


def switch_event_menu(p):
	time.sleep(0.4)

	global MERGE
	global radio
	global host
	global current
	global vol
	if GPIO.input(MENU_SWITCH):

		if MERGE == 0:
			exec_cmd('su - pi -c "vlc '+host+' -I rc --rc-host 127.0.0.1:4222 --novideo -d && ls"')
Exemplo n.º 3
0
#
# $Id: display_ip.py,v 1.1 2013/06/11 11:46:56 bob Exp $

import os
from lcd_class import Lcd

lcd = Lcd()

def interrupt():
	return False

# Execute system command
def exec_cmd(cmd):
        p = os.popen(cmd)
        result = p.readline().rstrip('\n')
        return result

lcd.init()
lcd.setWidth(16)
myip = exec_cmd('hostname -I')
count = 5
while  count > 0:
	lcd.scroll1("IP:" + myip, interrupt)
	lcd.line2("Line 2: defghijk")
	count = count - 1

lcd.line1("IP:" + myip)

# End

Exemplo n.º 4
0
#!/usr/bin/env python
#

# Imports
from lcd_class import Lcd
from time import sleep
from time import strftime

lcd = Lcd()

# LCD interrupt scroll routine
def interrupt():
	return False

lcd.init()
lcd.setWidth(16)

# Display line 1 and 2
lcd.line1("Line 1: Test LCD")
lcd.line2("Line 2: defghijk")
sleep(3)

while True:
	todaysdate = strftime("%H:%M %d/%m/%Y")
	lcd.line1(todaysdate) 
	lcd.scroll2("Line 4: abcdefghijklmnopqrstuvwxyz 0123456789",interrupt) 

# End
Exemplo n.º 5
0
lcd.init()
mesaj_array = ['','','','','','','','','','','']
from time import strftime
msg = ""
while True:
	#msg =""
	user = '******' 
	Mailbox = poplib.POP3_SSL('pop.googlemail.com', '995') 
	Mailbox.user(user) 
	Mailbox.pass_('frigider') 
	numMessages = len(Mailbox.list()[1])
	if numMessages != 0:
		msg=""
		todaysdate = strftime("%H:%M") 
		mesaj = "Primit la " +todaysdate + " "
		lcd.line1(mesaj)
#		for i in range(numMessages):
	        for txt in Mailbox.retr(1)[1]:
#			f.write(txt+"\n")
			msg = msg+"\n"+txt
	

		Mailbox.quit()
#		f.close()

		start = msg.find("Message-ID: ")
		n_f=msg.find("From:", start)
#		n_f=msg.find("From:")
		m_f=msg.find("<", n_f)
		mesaj = mesaj + msg[n_f:m_f]
		n_s=msg.find("Subject:")
Exemplo n.º 6
0
#!/usr/bin/env python
#
# $Id: test_lcd.py,v 1.5 2013/07/01 11:51:20 bob Exp $

from radio_class import Radio
from lcd_class import Lcd

lcd = Lcd()

def interrupt():
        return False

lcd.init()
lcd.setWidth(16)
lcd.line1("Bob Rathbone")

while True:
        lcd.scroll2("Line 2: abcdefghijklmnopqrstuvwxyz 0123456789",interrupt) 



Exemplo n.º 7
0
if width is 0:
    print "Set the lcd_width parameter in /etc/radiod.conf"
    sys.exit(1)

lcd.setWidth(width)

if len(sys.argv) > 1:
    text = translate.escape(sys.argv[1])
else:
    text = "Bob Rathbone"

lcd.line3("Line 3")
lcd.line4("Line 4")

while True:
    try:
        if len(text) > width:
            lcd.scroll1(text, interrupt)
        else:
            lcd.line1(text)

        lcd.scroll2("Line 2: abcdefghijklmnopqrstuvwxyz 0123456789", interrupt)

    except KeyboardInterrupt:
        print "\nExit"
        GPIO.setwarnings(False)
        GPIO.cleanup()
        sys.exit(0)

# End of test program
Exemplo n.º 8
0
    time_string = strftime("%H:%M")
    if STATE == 0:
		alt_state="METEO"
    if STATE==1:
		alt_state = "RADIO"
    if STATE==2:

		alt_state = "MAIL"

    if STATE==3:
		alt_state="NEWS"

    altele = alt_state+" "+AUTO
    if nr_new_msg!=0:
		altele=" M"+str(nr_new_msg)
    lcd.line1(time_string+" "+altele)
#	time.sleep(.1)
#    lcd_time=inceput

#    if STATE==METEO:
    if (inceput - METEO_time)>=900:
        FLAG=get_forecast()
        METEO_time=time.time()

    if (inceput - MAIL_time)>=67:#sa incercam un numar prim
        get_mail()
        MAIL_time=time.time()

    if (inceput-orar_start)>=30:
	centrala()#verifica daca e cazul sa faca ceva la centrala
	orar_start=time.time()
Exemplo n.º 9
0
    time_string = strftime("%H:%M")
    if STATE == 0:
		alt_state="METEO"
    if STATE==1:
		alt_state = "RADIO"
    if STATE==2:

		alt_state = "MAIL"

    if STATE==3:
		alt_state="NEWS"

    altele = alt_state+" "+AUTO
    if nr_new_msg!=0:
		altele=" M"+str(nr_new_msg)
    lcd.line1(time_string+" "+altele)#ce afisam pe prima linie a lcd-ului
#	time.sleep(.1)
#    lcd_time=inceput

#    if STATE==METEO:
    if (inceput - METEO_time)>=900:#actualizari
        FLAG=get_forecast()
        METEO_time=time.time()
	logging.debug('meteo updated')

    if (inceput - rss_time)>=900:
        FLAG_RSS=get_rss()
        rss_time=time.time()
	logging.debug('rss updated')

Exemplo n.º 10
0
time_stamp = time.time()
time_now = time_stamp
def exec_cmd(cmd): 
	p = os.popen(cmd)
	result = ""
	while p.readline():
	        result = result + p.readline()
#.rstrip('\n')
        return result

number = 0
lcd.init() 
todaysdate = strftime("%H:%M %d/%m/%Y") 
ipaddr = exec_cmd('hostname -I') 
text_line1= str(todaysdate)
lcd.line1(text_line1)
text_line2 = ipaddr 
lcd.line2(text_line2) 


def switch_event_menu(p):
#	time.sleep(0.4)
        GPIO.remove_event_detect(p)
	global MERGE
	global radio, time_stamp
	global host
	global current, warp
	global vol
	global text_line1, text_line2, text_line1_old, text_line2_old
        time_now = time.time()
#        print time_now-time_stamp
Exemplo n.º 11
0
if width is 0:
	print "Set the lcd_width parameter in /etc/radiod.conf"
	sys.exit(1)

lcd.setWidth(width)

if len(sys.argv) > 1:
	text = translate.escape(sys.argv[1])
else:
	text = "Bob Rathbone"

lcd.line3("Line 3")
lcd.line4("Line 4")

while True:
	try:
		if len(text) > width:
			lcd.scroll1(text,interrupt)
		else:
			lcd.line1(text)

		lcd.scroll2("Line 2: abcdefghijklmnopqrstuvwxyz 0123456789",interrupt) 

	except KeyboardInterrupt:
		print "\nExit"
		GPIO.setwarnings(False)
		GPIO.cleanup()
		sys.exit(0)

# End of test program