Skip to content

Instantly share code, notes, and snippets.

@elktros
Last active March 27, 2021 14:36
Show Gist options
  • Save elktros/e36f4923253ae36f9b72d353ce251cce to your computer and use it in GitHub Desktop.
Save elktros/e36f4923253ae36f9b72d353ce251cce to your computer and use it in GitHub Desktop.
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