ร้านแนะนำ
เซ็นเซอร์วัดอุณหภูมิและความชื้น DHT11 temperature module humidity module
★★★★★ 5.0
|
ขายแล้ว 2
|
❤️ 4
฿25
- แบรนด์
- NoBrand
- หมวดหมู่
- Clocks
- สภาพ
- New
- คงเหลือ
- 452 รายการ
- ร้านค้า
-
ช็อป99
ตัวเลือกที่เลือก
เซ็นเซอร์วัดอุณหภูมิและความชื้น DHT11 temperature module humidity module
฿25
รายละเอียด
เซ็นเซอร์วัดอุณหภูมิและความชื้น DHT11 temperature module humidity module
Specification:
Supply Voltage: +5 V / 2.5mA
Temperature range :0-50 C error of 2 C
Humidity :20-90% RH 5% RH error
Interface: Digital
pin:
1,Vcc,Power supply 3.5V to 5.5V
2,Data,Outputs both Temperature and Humidity through serial Data
3,Ground,Connected to the ground of the circuit
#include //----------------dht11 show temp/humid to i2c lcd------------------
#include
#include
//#include
//LiquidCrystal_I2C lcd(0x3F,16,2); // set the LCD address to 0x27 for a 16 chars and 2 line display
#define DHTTYPE DHT11
#define DHTPIN 7
DHT dht(DHTPIN,DHTTYPE,30);
void setup(){
Serial.begin(115200);
dht.begin();
// lcd.begin(); // initialize the lcd
// Print a message to the LCD.
// lcd.backlight();
delay(2500);
lcd.clear();
}
void loop()
{
// Wait a few seconds between measurements.
delay(2000);
float h = dht.readHumidity();
float t = dht.readTemperature();
float f = dht.readTemperature(true);
if (isnan(h) || isnan(t) || isnan(f))
{
Serial.println("Failed to read from DHT sensor!");
return;
}
float hif = dht.computeHeatIndex(f, h);
float hic = dht.computeHeatIndex(t, h, false);
//-------------------------Print to screen COM.?------
Serial.print("Temperature: ");
Serial.print(t);
Serial.println(" *C ");
Serial.print("Humidity: ");
Serial.print(h);
Serial.print(" % ");
//--------------------------------------LCD I2c------
/* lcd.setCursor(0,0); //บรรทัดที่ 0 ตำแหน่งที่ 0
lcd.print("Temperature:"); //print show LCD i2c
lcd.print(t);
lcd.setCursor(0,1); //บรรทัดที่ 1 ตำแหน่งที่ 0
lcd.print("Humidity:"); //print show LCD i2c
lcd.print(h);
delay(250);*/
}