#define BLYNK_TEMPLATE_ID "TMPLeBxJKKTg"
#define BLYNK_TEMPLATE_NAME "arduniono1"
#define BLYNK_AUTH_TOKEN "WjjFeCb82fUFCB2nrZMLiyRW4tcUhUBP"
#define BLYNK_FIRMWARE_VERSION "0.3.7"
// Comment this out to disable prints and save space
#define BLYNK_PRINT Serial
#include <Wire.h>
#include <WiFi.h>
#include <BlynkSimpleEsp32.h>
char auth[] = BLYNK_AUTH_TOKEN;
#define LED_BUILTIN 2 // define the GPIO 2 as LED_BUILTIN
char ssid[] = "Wokwi-GUEST";
char pass[] = "";
//--------------------------------------------------------------------------------------
BLYNK_WRITE_DEFAULT() {
unsigned int button = request.pin;
if(button == 0){
digitalWrite(LED_BUILTIN, param.asInt());
}
if(button == 1){
digitalWrite(26, param.asInt());
}
}
//---------------------------------------------------------------------------------
BlynkTimer timer;
void myTimer(){
// You can send any value at any time.
// Please don't send more that 10 values per second.
Blynk.virtualWrite(V2, millis()/1000);
}
void setup() {
Serial.begin(115200);
pinMode(LED_BUILTIN, OUTPUT); // initialize GPIO pin 2 LED_BUILTIN as an output.
pinMode(26, OUTPUT);
Blynk.begin(auth, ssid, pass, "blynk.cloud", 80);
// Setup a function to be called every second
timer.setInterval(10000L, myTimer);
}
void loop() {
Blynk.run();
timer.run(); // Initiates BlynkTimer
}