New Search

If you are not happy with the results below please do another search

1 search result for:

1

Raspberry Pi DHT11 DHT22 Temperature and Humidity Sensor Python

sudo pip3 install Adafruit_DHT แบบที่ 1  #!/usr/bin/pythonimport sysimport Adafruit_DHTwhile True:humidity, temperature = Adafruit_DHT.read_retry(11, 8) #DHT11# humidity, temperature = Adafruit_DHT.read_retry(22, 8) #DHT22if humidity is not None and temperature is not None:print (‘Temp={0:0.1f}*C Humidity={1:0.1f} %’.format(temperature, humidity))else:print (‘Failed to get reading. Try again!’) แบบที่ 2 #!/usr/bin/pythonimport sysimport Adafruit_DHTimport timesensor=Adafruit_DHT.DHT11 # ใส่อุปกรณ์ที่ใช้ในที่นี้คือ DHT11#sensor=Adafruit_DHT.DHT22pin=8 # PIN ของ GPIO ที่เชื่อมต่อกับ DHTwhile […]