Hello,
best wishes from Germany .
I need help with my little Projekt.
I want to blink a Digital Output (DO23) if Button V0 is ON and control the Blink ON Time with Slider V1 (0sec.-5sec.) and Blink OFF Time with Slider V2 (0sec.-5sec.)
But if i do it like that, the LED ist permanent ON. How can i control the delay time withe the Slider?
Best wishes,
Patrick
/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial
/* Fill-in your Template ID (only if using Blynk.Cloud) */
//#define BLYNK_TEMPLATE_ID "YourTemplateID"
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "xxx";
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "xxx";
char pass[] = "xxx";
int dunkel=0;
int hell=0;
int ein=0;
BLYNK_WRITE(V0) {
if (param.asInt()) { // If receiving a 1
ein=HIGH;
Serial.println(ein);
}
else { ein=LOW;
Serial.println(ein);}
}
BLYNK_WRITE(V1)
{
//reads the slider value when it changes in the app
int hell = param.asInt();
Serial.println(hell);
}
BLYNK_WRITE(V2)
{
//reads the slider value when it changes in the app
int dunkel = param.asInt();
Serial.println(dunkel);
}
void setup()
{
pinMode(23, OUTPUT);
// Debug console
Serial.begin(9600);
Blynk.begin(auth, ssid, pass);
}
void loop()
{
Blynk.run();
if (ein == HIGH) {
digitalWrite(23, HIGH);
delay(hell);
digitalWrite(23, LOW);
delay(dunkel);
}
}