Created
August 20, 2019 15:52
-
-
Save baobao/4c9b7d2d29b963213d37f1df0071ccc4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <DHT.h> | |
int pin = 9; | |
DHT dht(pin, DHT11); | |
void setup() | |
{ | |
Serial.begin(9600); | |
dht.begin(); | |
} | |
void loop() | |
{ | |
// 湿度 | |
float percentHumidity = dht.readHumidity(); | |
// 温度 | |
float temperature = dht.readTemperature( isFahrenheit_ ); | |
Serial.println(percentHumidity); | |
Serial.println(temperature); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment