void Sync()
{
CH1Period = CH1End - CH1Start;
CH2Period = CH2End - CH2Start;
CH3Period = CH3End - CH3Start;
CH4Period = CH4End - CH4Start;
CH5Period = CH5End - CH5Start;
CH6Period = CH6End - CH6Start;
}
}
//CHANNEL 2/////////////////////////////////////////////////////////////////////
BLYNK_WRITE(V8) //Start time
{
CH2S = param.asInt();
Blynk.virtualWrite(V8, CH2S);
CH2Start = CH2S*60;
////EEPROM.put(25, CH2Start);
////EEPROM.commit();
}
BLYNK_WRITE(V9) //End time
{
CH2E = param.asInt();
Blynk.virtualWrite(V9, CH2E);
CH2End = CH2E*60;
////EEPROM.put(30, CH2End);
////EEPROM.commit();
}
BLYNK_WRITE(V10) //FadeIn time
{
FadeINmin2 = param.asInt();
Blynk.virtualWrite(V10, FadeINmin2);
FadeINsecs2 = FadeINmin2*60;
////EEPROM.put(35, FadeINsecs2);
////EEPROM.commit();
}
BLYNK_WRITE(V11) //FadeOut time
{
FadeOUTmin2 = param.asInt();
Blynk.virtualWrite(V11, FadeOUTmin2);
FadeOUTsecs2 = FadeOUTmin2*60;
////EEPROM.put(40, FadeOUTsecs2);
////EEPROM.commit();
}
BLYNK_WRITE(V12) //Intensity value
{
maxPWM2 = param.asInt();
Blynk.virtualWrite(V12, maxPWM2);
}
BLYNK_WRITE(V56) //Saved Intensity value
{
svPWM2 = param.asInt();
Blynk.virtualWrite(V56, svPWM2);
////EEPROM.put(45, svsvPWM2);
////EEPROM.commit();
}
BLYNK_READ(V39)
{
Blynk.virtualWrite(V39, C2prog);
}
//CHANNEL 3/////////////////////////////////////////////////////////////////////
BLYNK_WRITE(V14) //Start time
{
CH3S = param.asInt();
Blynk.virtualWrite(V14, CH3S);
CH3Start = CH3S*60;
////EEPROM.put(50, CH3Start);
////EEPROM.commit();
}
BLYNK_WRITE(V15) //End time
{
CH3E = param.asInt();
Blynk.virtualWrite(V15, CH3E);
CH3End = CH3E*60;
////EEPROM.put(55, CH3End);
////EEPROM.commit();
}
BLYNK_WRITE(V16) //FadeIn time
{
FadeINmin3 = param.asInt();
Blynk.virtualWrite(V16, FadeINmin3);
FadeINsecs3 = FadeINmin3*60;
////EEPROM.put(60, FadeINsecs3);
////EEPROM.commit();
}
BLYNK_WRITE(V17) //FadeOut time
{
FadeOUTmin3 = param.asInt();
Blynk.virtualWrite(V17, FadeOUTmin3);
FadeOUTsecs3 = FadeOUTmin3*60;
////EEPROM.put(65, FadeOUTsecs3);
////EEPROM.commit();
}
BLYNK_WRITE(V18) //Intensity value
{
maxPWM3 = param.asInt();
Blynk.virtualWrite(V18, maxPWM3);
}
BLYNK_WRITE(V57) //Saved Intensity value
{
svPWM3 = param.asInt();
Blynk.virtualWrite(V57, svPWM3);
////EEPROM.put(70, PWM3);
////EEPROM.commit();
}
BLYNK_READ(V40)
{
Blynk.virtualWrite(V40, C3prog);
}
//CHANNEL 4/////////////////////////////////////////////////////////////////////
BLYNK_WRITE(V20) //Start time
{
CH4S = param.asInt();
Blynk.virtualWrite(V20, CH4S);
CH4Start = CH4S*60;
////EEPROM.put(75, CH4Start);
////EEPROM.commit();
}
BLYNK_WRITE(V21) //End time
{
CH4E = param.asInt();
Blynk.virtualWrite(V21, CH4E);
CH4End = CH4E*60;
////EEPROM.put(80, CH4End);
////EEPROM.commit();
}
BLYNK_WRITE(V22) //FadeIn time
{
FadeINmin4 = param.asInt();
Blynk.virtualWrite(V22, FadeINmin4);
FadeINsecs4 = FadeINmin4*60;
////EEPROM.put(85, FadeINsecs4);
//EEPROM.commit();
}
BLYNK_WRITE(V23) //FadeOut time
{
FadeOUTmin4 = param.asInt();
Blynk.virtualWrite(V23, FadeOUTmin4);
FadeOUTsecs4 = FadeOUTmin4*60;
//EEPROM.put(90, FadeOUTsecs4);
//EEPROM.commit();
}
BLYNK_WRITE(V24) //Intensity value
{
maxPWM4 = param.asInt();
Blynk.virtualWrite(V24, maxPWM4);
}
BLYNK_WRITE(V58) //Saved Intensity value
{
svPWM4 = param.asInt();
Blynk.virtualWrite(V58, svPWM4);
//EEPROM.put(95, PWM4);
//EEPROM.commit();
}
BLYNK_READ(V41)
{
Blynk.virtualWrite(V41, C4prog);
}
This my code for my 8 channel Led lighting. Try to use Blynk only as a method to get the info and write your code in a way that the lighting can run without the need to keep referring back to Blynk. The reason if the internet drops the lighting schedule will continue as normal. Hope this helps.