#define BLYNK_TEMPLATE_ID "TMPLtMSl8qwF"
#define BLYNK_DEVICE_NAME "PreAct"
#define BLYNK_AUTH_TOKEN "l6zVUnl-3BtXUibphVqv8y5F9c2gPVLt"
#define BLYNK_PRINT Serial
#include <WiFi.h>
#include <BlynkSimpleEsp32.h>
#include <DHT.h>
#define LED_PIN 26
#define DHT_PIN 33
#define DHTTYPE DHT22
DHT dht(DHT_PIN,DHTTYPE);
int LED_Value = 0;
char auth[] = BLYNK_AUTH_TOKEN;
BLYNK_WRITE(V0)
{
LED_Value = param.asInt();
if (LED_Value == 1){
digitalWrite(LED_PIN,HIGH);
}
else{
digitalWrite(LED_PIN, LOW);
}
}
void setup()
{
Serial.begin(115200);
dht.begin();
pinMode(LED_PIN, OUTPUT);
Blynk.begin(auth, "Wokwi-GUEST", "");
delay(1000);
}
void loop()
{
//int t = 20;
//int h = 30;
float t = dht.readTemperature();
float h = dht.readHumidity();
Blynk.run();
Blynk.virtualWrite(V2, t);
Blynk.virtualWrite(V3, h);
}