#define BLYNK_TEMPLATE_ID "TMPLLHXMInFJ";
#define BLYNK_DEVICE_NAME "Moumita";
#define BLYNK_AUTH_TOKEN "7M5t8oqbf0aj70R_EtIjZp_srHa_4gLk";
// Comment this out to disable prints and save space
#define BLYNK_PRINT Serial
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
char auth[] = BLYNK_AUTH_TOKEN;
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "Wokwi-GUEST";
char pass[] = "";
int button1 = 27;
// This function will be called every time Slider Widget
// in Blynk app writes values to the Virtual Pin V1
BLYNK_WRITE(V1)
{
if(param.asInt()==1){
digitalWrite(19, HIGH);
}
else{
digitalWrite(19, LOW); // assigning incoming value from pin V1 to a variable
}
// process received value
}
void setup()
{
pinMode(button1, INPUT_PULLUP);
pinMode(19, OUTPUT);
Serial.begin(115200);
// Debug console
//Serial.begin(115200);
//pinMode(19,OUTPUT);
Blynk.begin(auth, ssid, pass);
// You can also specify server:
//Blynk.begin(auth, ssid, pass, "blynk.cloud", 80);
//Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8080);
}
void loop()
{
int condition = digitalRead(button1);
Serial.println(condition);
if (condition == LOW) {
digitalWrite(19, HIGH);
}
else {
digitalWrite(19, LOW);
}
Blynk.run();
}