Amateur Member
|
目前可以更新了,但是時間會因為偵測而延遲數秒更新
謝謝dark angel的幫忙
最後改好的程式碼如下
import RPi.GPIO as GPIO
import Adafruit_DHT
import I2C_LCD_driver
from time import *
import time
mylcd = I2C_LCD_driver.lcd()
while True:
humidity, temp = Adafruit_DHT.read_retry(22, 4)
mylcd.lcd_display_string("Time: %s" %time.strftime("%H:%M:%S"), 1)
mylcd.lcd_display_string("Date: %s" %time.strftime("%m/%d/%Y"), 2)
mylcd.lcd_display_string("temperature: %.2f C" % temp, 3)
mylcd.lcd_display_string("Humidity: %.2f %%" % humidity, 4)
|