Example #1
0
def show_stock(stocks = '/home/pi/stocks.ls'):
    lcd.draw_bitmap(STOCK_ICON)
    time.sleep(5)
    
    lines = [l.strip() for l in open(stocks, 'r')]

    for s in __get_stock_data__(lines):
        lcd_ext.marquee_display_words(s, 5)
        time.sleep(2)
Example #2
0
def show_earthquake():
    e = __get_recent_earthquake__()
    if e == None: return
    
    # if this earthquake is expired, older than two hours
    # not show
    if (time.time() - time.mktime(e['time'])) > RECENT_TIME: return
    
    lcd.display_words([chr(213) + chr(205) * 12 + chr(184),
                       chr(179) + " " * 12 + chr(179),
                       chr(179) + " EARTHQUAKE " + chr(179), 
                       chr(179) + "  in WORLD  " + chr(179),
                       chr(179) + " " * 12 + chr(179),
                       chr(212) + chr(205) * 12 + chr(190)])    
    time.sleep(4)
    
    lcd.alarm(3)
    lcd_ext.marquee_display_words([time.strftime("%m/%d %H:%M:%S", e['time']), e['place'], e['mag'], e['lat'], e['lon'], e['dep']], 1)
    lcd.alarm(3)
    time.sleep(2)