Using sensor dht11

which use for example using the sensor dht11.
and what libraries have to download.

thank you.

I’ve been using the DHT library. I think it contains a few examples. Here’s how I’ve been using it for my home-brewed Nest-style IoT thermostat:

1 Like

Thank you very much for your help, I managed to bring up the humidity and temperature values on the display value of blynk.
Now how do I put Âşc% and in front of the values?

I made this code.

define BLYNK_PRINT Serial // Comment this out to disable prints and save space
include <SPI.h>
include <Ethernet.h>
include <BlynkSimpleEthernet.h>
include <dht.h>
define dht_dpin A0 //Pino DATA do Sensor ligado na porta Analogica A1
dht DHT; //Inicializa o sensor

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = “xxxxxxxxxxxxxxxxxxxxxxxxxxx”;

void setup()
{
Serial.begin(9600);
Blynk.begin(auth);
// You can also specify server.
// For more options, see BoardsAndShields/Arduino_Ethernet_Manual example
//Blynk.begin(auth, “your_server.com”, 8442);
//Blynk.begin(auth, IPAddress(192,168,1,100), 8888);
}

void loop()
{
Blynk.run();
DHT.read11(dht_dpin); //Lê as informações do sensor
Blynk.virtualWrite(1, DHT.temperature);
Blynk.virtualWrite(2, DHT.humidity);
delay(1000);
}

I’m not using the degree symbol or C/F on my dashboard, but there are instructions for doing so at the bottom of this page:

Sorted out. Thanks a lot for the help.

A0? DHT11 uses digital output,
do it like
#include <DHT.h>
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <SimpleTimer.h>
#define DHTPIN 14

DHT dht(DHTPIN, DHTTYPE);

SimpleTimer timer; 
char auth[] =


void setup()
{
  Serial.begin(9600);
    Blynk.begin(auth,
     dht.begin();
 
}

void readtemp()
{
float h = dht.readHumidity();//outside
 Blynk.virtualWrite(V1, h);

 float t = dht.readTemperature();//outside
 Blynk.virtualWrite(V2, t);
|....

You can use this to display:

int tempHumid = (int)h;
  int tempTemp  = (int)c;
  
  String humid  = (String)tempHumid;
  String temp   = (String)tempTemp;
  
  humid += "%";
  temp += "°C";

Change variable names, but this is how I do it :slight_smile: