Code pull completed, the page will refresh automatically
DHT Temperature & Humidity Sensor library for Arduino
#include <Arduino.h>
#include <DHT.h>
#define DHT_DATA_pin 8
DHT dht;
void setup() {
Serial.begin(115200);
// load DHT Data pin
dht.load(DHT_DATA_pin);
//取一次
String result=dht.get();
Serial.println(result);
//取温湿度数值
double d_temp,d_hum;
dht.get(d_temp,d_hum);
Serial.println(d_temp);
Serial.println(d_hum);
//取平均
String Data="";
//取3次平均值,每次间隔3000ms
Data=dht.get_a(3,3000);
//如果需要单独取数值
dht.get_a(d_temp,d_hum,3,3000);
Serial.println(d_temp);
Serial.println(d_hum);
Serial.println(Data);
}
You can comment after Login
Inappropriate content may be displayed here and will not be shown on the page. You can check and modify it through the relevant editing function
If you confirm that the content does not involve inappropriate language/advertisement redirection/violence/vulgar pornography/infringement/piracy/false/insignificant or illegal content related to national laws and regulations, you can click submit to make an appeal, and we will handle it as soon as possible.
Comments ( 0 )