#define BLYNK_TEMPLATE_ID "TMPL61q8GMEkg"
#define BLYNK_TEMPLATE_NAME "ESP8266 WIFI"
#define BLYNK_AUTH_TOKEN "ssCAJHkFMxMwbvXlL1-IVgQ2_mMZTISw"
#if defined(ESP8266)
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#elif defined(ESP32)
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
#endif
char auth[] = BLYNK_AUTH_TOKEN;
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "Wokwi-GUEST";
char pass[] = "";
BLYNK_WRITE(V0) {
int pinValue = param.asInt();
digitalWrite(4, pinValue);
}
BLYNK_WRITE(V1) {
int pinValue = param.asInt();
digitalWrite(2, pinValue);
}
BLYNK_CONNECTED() {
Blynk.setProperty(V3, "offImageUrl", "https://static-image.nyc3.cdn.digitaloceanspaces.com/general/fte/congratulations.png");
Blynk.setProperty(V3, "onImageUrl", "https://static-image.nyc3.cdn.digitaloceanspaces.com/general/fte/congratulations_pressed.png");
Blynk.setProperty(V3, "url", "https://docs.blynk.io/en/getting-started/what-do-i-need-to-blynk/how-quickstart-device-was-made");
}
void setup() {
// Debug console
Serial.begin(115200);
pinMode(4, OUTPUT); // PIN DIGITAL D1
pinMode(2, OUTPUT); // PIN DIGITAL D2
Blynk.begin(auth, ssid, pass);
}
void loop() {
Blynk.run();
}