Skip to content

Instantly share code, notes, and snippets.

@elktros
Last active March 27, 2021 14:36
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
Code for ESP32 DHT11 Serial Output.
#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