#define BLYNK_PRINT Serial

#define BLYNK_TEMPLATE_ID "TMPL6OwQ4AoOA"
#define BLYNK_TEMPLATE_NAME "DHT22"
#define BLYNK_AUTH_TOKEN "ZLPHXQzVzyA8qxt1Hw2J1UA50lrn52UG"

#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
#include "DHTesp.h"

int DHT_PIN = 21;
DHTesp dhtSensor;

char auth[] = BLYNK_AUTH_TOKEN;
char ssid[] = "Wokwi-GUEST";
char pass[] = "";


void setup()
{
  Serial.begin(115200);
  Blynk.begin(auth, ssid, pass);
  dhtSensor.setup(DHT_PIN, DHTesp::DHT22);
  
}

void loop()
{
  Blynk.run();
  float t = dhtSensor.getTemperature();
  float h = dhtSensor.getHumidity();
   Serial.print("Temp: ");
  Serial.print(t);
  Serial.println(" °C");
  Serial.print("Humidity: ");
  Serial.print(h);
  Serial.println(" %");
  Serial.println("---");
  Blynk.virtualWrite(V1, t); 
  Blynk.virtualWrite(V2, h);
  delay(1000);
}