Last active
March 27, 2021 14:36
-
-
Save elktros/e36f4923253ae36f9b72d353ce251cce to your computer and use it in GitHub Desktop.
Code for ESP32 DHT11 Serial Output.
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" | |
#define DHT11PIN 16 | |
DHT dht(DHT11PIN, DHT11); | |
void setup() | |
{ | |
Serial.begin(115200); | |
/* Start the DHT11 Sensor */ | |
dht.begin(); | |
} | |
void loop() | |
{ | |
float humi = dht.readHumidity(); | |
float temp = dht.readTemperature(); | |
Serial.print("Temperature: "); | |
Serial.print(temp); | |
Serial.print("ºC "); | |
Serial.print("Humidity: "); | |
Serial.println(humi); | |
delay(1000); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment