#define BLYNK_PRINT Serial
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
// You should get Auth Token in the Blynk App.
const int buttonPin = 4; // the number of the pushbutton pin
#define BLYNK_TEMPLATE_ID "TMPL6SBc40B36"
#define BLYNK_TEMPLATE_NAME "COUNT button"
#define BLYNK_AUTH_TOKEN "cfHYhfpCoCaK3ncH_99BcucZLxB6Gz9x"
// Go to the Project Settings (nut icon).
// Your WiFi credentials.
// Set password to "" for open networks.
char auth[] = BLYNK_AUTH_TOKEN;
char ssid[] = "Wokwi-GUEST";
char pass[] = "";
BLYNK_WRITE (V0)
{if (param.asInt ()==1)
digitalWrite(5, HIGH);
else
digitalWrite(5, LOW);
}
BLYNK_CONNECTED () {
Serial.println("connected");
Blynk.syncVirtual(V0);
}
void setup()
{
// Debug console
Serial.begin(115200);
pinMode(buttonPin, INPUT);
pinMode(5, OUTPUT);
Blynk.begin(auth, ssid, pass);
}
void loop()
{
Blynk.run();
}