2017年2月8日 星期三

【MicroPython】LAB01 - DHT11 溫濕度

【MicroPython】LAB01 - DHT11 溫濕度



User@User-PC MINGW64 /c/mini3

$ cat DHT11.py
import machine
import dht
import time

d = dht.DHT11(machine.Pin(4))

for i in range (1,11) :
    a0=d.measure()
    a1=d.temperature() # eg. 23 (▒XC)
    a2=d.humidity()    # eg. 41 (% RH)

    print ('temperature {0:2d}'.format(a1))
    print ('humidity {0:2d}'.format(a2))

    time.sleep(1.0)


#=========================================
# d = dht.DHT22(machine.Pin(4))
# d.measure()
# d.temperature() # eg. 23.6 (▒XC)
# d.humidity()    # eg. 41.3 (% RH)
#=========================================
User@User-PC MINGW64 /c/mini3

$ ampy --port COM8 run DHT11.py
temperature 26
humidity 34
temperature 26
humidity 34
temperature 26
humidity 34
temperature 26
humidity 34
temperature 26
humidity 34
temperature 26
humidity 34
temperature 26
humidity 34
temperature 26
humidity 34
temperature 26
humidity 34
temperature 26
humidity 34

User@User-PC MINGW64 /c/mini3
$

沒有留言:

張貼留言

結合桌面視窗介面 (GUI)、雲端資料庫與社群通訊推播的自動化氣象監控系統

視窗介面 (GUI)、雲端資料庫與社群通訊推播的自動化氣象監控系統 這份 gui_app_timer.py 程式是一個 結合桌面視窗介面 (GUI)、雲端資料庫與社群通訊推播的自動化氣象監控系統 。 整體架構採用 事件驅動 (Event-Driven) 與 多執行緒非同步設計...