Hi, it’s my first time here asking to the community,
So, its simple problem i guess, i’ve been looking around almost for 3 days but none of the existing code i’ve learned work in my sketch,
What i want to do is, create a SwitchButton on V1, When the switch turn on, the LED will turn on for 10 seconds, and then, after 10 seconds the switch automatically back to off also the LED,
I’m using ESP8266-01 GPI02 connected to my LED,
here is my existing code without timer/hold/delay function, only turn on and off
/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "invisible";
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "ABAH NET";
char pass[] = "DAVINAFUAD123";
int LED = 2;
BLYNK_WRITE(V1) //Button Widget is writing to pin V1
{
int pinData = param.asInt();
if (pinData == 1)
{
digitalWrite(LED, HIGH);}
else
{
digitalWrite(LED, LOW);
}
}
void setup()
{
// Debug console
Serial.begin(9600);
Blynk.begin(auth, ssid, pass);
// You can also specify server:
//Blynk.begin(auth, ssid, pass, "blynk-cloud.com", 8442);
//Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8442);
}
void loop()
{
Blynk.run();
// You can inject your own code or combine it with other sketches.
// Check other examples on how to communicate with Blynk. Remember
// to avoid delay() function!
}