#define BLYNK_PRINT Serial
#define BLYNK_TEMPLATE_ID "TMPL3k3D_DV3E"
#define BLYNK_TEMPLATE_NAME "404708794033581057"
#define BLYNK_AUTH_TOKEN "_T8YNE2sdD8oJwd02hoL7tccEYG9DTbL"
#include <BlynkSimpleEsp32.h>
#include <DHT.h>
#include <WiFi.h>
#include <WiFiClient.h>
#define DHTPIN 27
#define DHTTYPE DHT22
char auth[] = BLYNK_AUTH_TOKEN;
char ssid[] = "Wokwi-GUEST";
char pass[] = "";
BlynkTimer timer;
DHT dht (DHTPIN, DHTTYPE);
void
sendSensor ()
{
double h = dht.readHumidity ();
double t = dht.readTemperature ();
if (isnan (h) || isnan (t))
{
Serial.println ("Failed to read from the DHT Sensor!");
return;
}
Blynk.virtualWrite (V1, t);
Blynk.virtualWrite (V2, h);
}
void
setup ()
{
Serial.begin (115200);
Blynk.begin (auth, ssid, pass);
dht.begin ();
timer.setInterval (100L, sendSensor);
}
void
loop ()
{
Blynk.run ();
timer.run ();
}