描述
技術規格
1.訊號傳輸型式: 數位 (Digital)
2.電壓範圍:3.0V ~ 5.5V。
3.測溫範圍:濕度 20~90%RH,溫度 0℃到50℃
4.精度:濕度 ±5%,溫度 ±2℃
商品內容
- DHT11 溫濕度感測模組 1個
- RJ11 6P4C 25cm 信號線 1條
程式範例
在此範例配合S4A IO Board 做簡單實驗顯示出溫濕度。
#include <dht.h>
#define dht_dpin 2 //Set channel sensor
dht DHT;
void setup(){
Serial.begin(9600);
delay(300);//Let system settle
Serial.println(“Humidity and temperature\n\n”);
delay(700);//Wait rest of 1000ms recommended delay before
//accessing sensor
}//end “setup()”
void loop(){
//This is the “heart” of the program.
DHT.read11(dht_dpin);
Serial.print(“Current humidity = “);
Serial.print(DHT.humidity);
Serial.print(“% “);
Serial.print(“temperature = “);
Serial.print(DHT.temperature);
Serial.println(“C “);
delay(800);
//Don’t try to access too frequently… in theory
//should be once per two seconds, fastest,
//but seems to work after 0.8 second.
}// end loop()
接線範例
接線方式如果搭配S4A IO Board只要把電話接頭(RJ11)接到標示D2D3孔位即可完成連接。