#define BLYNK_TEMPLATE_ID "TMPL7y7n5LBB"
#define BLYNK_TEMPLATE_NAME "UTS WATER ATM"
#define BLYNK_AUTH_TOKEN "OcY19ff25WgkEHuPYQPF6bx3gejukA3K"
#define BLYNK_PRINT Serial
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
char ssid[] = "Wokwi-GUEST";
char pass[] = "";
int x = 2;
int y = 4;
BLYNK_WRITE(V1)
{
int pinValue = param.asInt();
Serial.println(pinValue);
}
void setup()
{
Serial.begin(115200);
pinMode(x, INPUT_PULLUP);
pinMode(y, INPUT_PULLUP);
Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass);
// You can also specify server:
//Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass, "blynk.cloud", 80);
//Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass, IPAddress(192,168,1,100), 8080);
}
void loop()
{
Blynk.run();
if (!digitalRead(x)) {
Serial.println("X");
Blynk.disconnect();
}
if (!digitalRead(y)) {
Serial.println("Y");
Blynk.connect();
}
}