Example #1
0
def main():
    global lcd
    lcd.backlight(1)  # 1: On, 0: Off
    now_str_prev = datetime.datetime.now().strftime('%m-%d %H:%M:%S')
    is_said = False
    while True:
        now = datetime.datetime.now()
        now_str = datetime.datetime.now().strftime('%m-%d %H:%M:%S')
        if (now.second == 1):
            if not is_said:
                say(str(now.hour) + "時" + str(now.minute) + "分です")
                is_said = True
        if (now.second == 2):
            is_said = False

        if (datetime.datetime.now().second == 31):
            show_ip(2)
            show_temp(3)  # openjtalk が間に合わない
            show_humidity(2)
            show_humiditydeficit(2)
            show_CO2(2)

        if not now_str == now_str_prev:
            lcd.lcd_display_string(now_str)
            now_str_prev = now_str

        time.sleep(0.1)