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
$

沒有留言:

張貼留言

Galois LFSR

  在密碼學與數位訊號處理中, LFSR(線性回饋移位暫存器,Linear Feedback Shift Register) 是用來產生偽隨機序列(也就是串流加密中所需的金鑰流)最核心的硬體架構。 LFSR 主要分為兩種實現架構: Fibonacci(斐波那契) 與 Galo...