Example #1
0
    def run(self, output_fn, **kwargs):
        fd = open(output_fn, 'w')
        if not LCD.init_lcd():
            fd.write("Failed init lcd1602, stoping now.")
            return

        wlan0 = "None"
        eth0 = "None"
        t = 0
        while wlan0 != "None" or eth0 != "None":
            wlan0 = host.get_ip_address("wlan0")
            eth0 = host.get_ip_address("eth0")
            LCD.print_lcd(0, 0, "No network connect")
            LCD.print_lcd(0, 1, "%s times tried" % t)
            t += 0.5
            time.sleep(0.5)
        wlan0 = host.get_ip_address("wlan0")
        LCD.print_lcd(0, 0, "W" + wlan0)
        time.sleep(3)
        rund = 0
        LCD.clear_lcd()
        #d = 0
        #h = 0
        #m = 0
        #s = 0
        while True:
            #s += 1
            #if s%60 == 0:
            #	s = 0
            #	m += 1
            #	if m%60 == 0:
            #		m=0
            #		h += 1
            #		if h%24 == 0:
            #			h=0
            #			d += 1
            LCD.print_lcd(0, 0, wlan0)
            LCD.print_lcd(0, 1, host.get_up_time(
            ))  # "%s %s%s:%s%s:%s%s"%(d, h/10, h%10, m/10, m%10, s/10, s%10))
            time.sleep(1)
        fd.close()
Example #2
0
    # time.sleep(5)


    while True:
        # nowtime = datetime.now().strftime('%b %d %H:%M:%S')
        # mintime = time.strftime('%M',time.localtime(time.time()))
        # print('current time:'+nowtime)
        # LCD.print_lcd(0,0,nowtime)
        # if mintime == 59:
        # LCD.turn_light(1)
        # print('mintime:'+mintime)


        top = run_cmd(uptime)
        ipaddr = run_cmd(ip)

        LCD.print_lcd(0, 0, top[top.find(": ") + 2:].strip(','))
        LCD.print_lcd(0, 1, ipaddr[:ipaddr.find('\n')])

        time.sleep(2.5)

        LCD.clear_lcd()

        cpu_temp = get_cpu_temp()
        gpu_temp = get_gpu_temp()
        mem = get_mem_info()
        LCD.print_lcd(0, 0, cpu_temp)
        LCD.print_lcd(8, 0, gpu_temp)
        LCD.print_lcd(0, 1, mem)
        time.sleep(2.5)
        LCD.clear_lcd()