I wrote a small programm to edit my LED-Lamps. I’d like to have a virtual LCD display to show me what program mode is running. Before I implemented the display I was able to edit the delay time in the program Wave() with my virtual slider (delay(inerval); ). After implementing I could not edit this delay time any more by moving the slider. Please can someone help me with this problem?
#include <SPI.h>
#include <LEDFader.h>
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
char auth[] = "";
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "";
char pass[] = "";
#define LED_NUM 7
#define LED_PIN 7
int button_V0=0;
int button_V1=0;
//night Rider
int ledpin[] ={16,5,4,12,14,13,15}; //organize all PWM pins neatly.
int n = 0; //speed counter.
int i =0; // repeater.
int value[] ={0,0,0,0,0,0,0}; //lighting amount array for faders
int interval;
int z=0;
int stepperValue=0;
WidgetLCD lcd(V4);
// 6 LEDs (perhaps 2 RGB LEDs)
LEDFader leds[LED_NUM] = {
LEDFader(D0),
LEDFader(D1),
LEDFader(D2),
LEDFader(D5),
LEDFader(D6),
LEDFader(D7),
LEDFader(D8)
};
void setup() {
Serial.begin(115200);
Blynk.begin(auth, ssid, pass);
lcd.clear();
}
BLYNK_WRITE(V0)
{
if (param.asInt()) {
button_V1=0;
button_V0=1;
}
else {
stop_LED();
}
}
BLYNK_WRITE(V1)
{
if (param.asInt()) {
button_V0=0;
button_V1=1;
}
else {
stop_LED();
}
}
BLYNK_WRITE(V2) // Slider - Speed Time
{
interval = param.asLong();
}
BLYNK_WRITE(V3) // Mode
{
stepperValue = param.asInt();
}
BLYNK_WRITE(V6) // Wave Slider
{
z = param.asLong();
}
void loop() {
Blynk.run();
if ((stepperValue==0)&&(button_V0==1)){
randomfader();
//Blynk.virtualWrite(V4, "Fader");
}
if ((stepperValue==1)&&(button_V0==1)) {
nightRider();
//Blynk.virtualWrite(V4, "Rider");
}
if ((stepperValue==2)&&(button_V0==1)) {
Wave();
Blynk.virtualWrite(V4, "Wave");
}
if (button_V0==0){stop_LED();}
}
void Wave()
{
if(n == 100){value[z+0]=100;}
if(n == 200){value[z+0]=100;}
if(n == 300){value[z+1]=100;}
if(n == 400){value[z+2]=100;}
if(n == 500){value[z+3]=100;}
if(n == 600){value[z+4]=100;}
if(n == 700){value[z+5]=100;}
if(n == 800){value[z+6]=100;}
if(n == 900){value[z+0]=100;}
if(n == 1000){value[z+1]=100;}
if(n == 1100){value[z+2]=100;}
if(n == 1200){value[z+3]=100;}
if(n == 1300){value[z+4]=100;}
if(n == 1400){value[z+5]=100;}
if(n >= 1400){n =0;}
//fade all pins
for (i = 0; i <=6; i++)
{
if(value[i] >= 6){ value[i]-=1;}
else if (value[i] < 6) { value[i]=0;}
}
//write to all pins
for (i = 0; i <=6; i++)
{
analogWrite(ledpin[i], value [i]);
}
n+=5;
delay(interval); // <- This delay do not work after imlementing the LCD funktion
}