Help needed with starting sunsetleds

Hi There,

I learning some from this great software but having problems to get further.
I try to program a Wemos clone D1 Mini to a wake -up light.
I have some code form searching and the sunrise works if a placed it in the LOOP.
So now i want that when is tis alarm time V53 the sunrise start.
But cant find where i tell and how it must start.
Im new and not good with programming ( concentration isiue )
So how can bring me further
Leo

V1.0
werkend!
timer schakelt aan en uit en knop kan handmatig schakelen
********************/
#define BLYNK_PRINT Serial    // Comment this out to disable prints and save space
//#include <Adafruit_NeoPixel.h>
#include "FastLED.h"
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <SimpleTimer.h>
#include <TimeLib.h>
#include <WidgetRTC.h>
#include <math.h>
//Adafruit_NeoPixel strip = Adafruit_NeoPixel(16, PIN, NEO_GRB + NEO_KHZ800);
#define NUM_LEDS 16
#define DATA_PIN 6
CRGB leds[NUM_LEDS];
char auth[] = "814bc107fb2c494ea61e75bdf61ea104";

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "EHCO.nl";
char pass[] = "Draadloos1";
SimpleTimer timer;
WidgetRTC rtc;

char Date[16];
char Time[16];
int manual=0;

long startsecondswd;            // weekday start time in seconds
long stopsecondswd;             // weekday stop  time in seconds
long nowseconds;                // time now in seconds

int transitionTime = 5000; // Tranition Time in ms

void setup() 
{
  FastLED.addLeds<WS2812B, DATA_PIN, BGR>(leds, NUM_LEDS);
  WiFi.mode(WIFI_STA);
  Serial.begin(115200); // See the connection status in Serial Monitor
  Blynk.begin(auth, ssid, pass);
  rtc.begin();
  Blynk.virtualWrite(V49, 1);
  delay(10);
  

  timer.setInterval(60000L, syncRelay);
  timer.setInterval(1000,showCurrentTime);




}
BLYNK_WRITE(V49)
{
  if (param.asInt()==1) 
  {
    manual=1;
  } 
  else 
  {
    manual=0;
  }
}



BLYNK_WRITE(V50)//Fauntain 
{  
    if (manual==1)
      { 
      
      sprintf(Date, "%02d/%02d/%04d",  day(), month(), year());
      sprintf(Time, "%02d:%02d:%02d", hour(), minute(), second());
    
      TimeInputParam t(param);
      Serial.println(Time);
      Serial.println(Date);
    
      int dayadjustment = -1;  
      if(weekday() == 1){
        dayadjustment =  6; // needed for Sunday, Time library is day 1 and Blynk is day 7
      }
      if(t.isWeekdaySelected(weekday() + dayadjustment)){ //Time library starts week on Sunday, Blynk on Monday
            
      nowseconds = ((hour() * 3600) + (minute() * 60) + second());
      startsecondswd = (t.getStartHour() * 3600) + (t.getStartMinute() * 60);
      Serial.println(startsecondswd);  // used for debugging
      if(nowseconds >= startsecondswd){    
        
        if(nowseconds <= startsecondswd + 90){    // 90s on 60s timer ensures 1 trigger command is sent
          Blynk.virtualWrite(V51, 1);
          // code here to switch the relay ON
        }      
      }
      else
      {
      }
      stopsecondswd = (t.getStopHour() * 3600) + (t.getStopMinute() * 60);
      Serial.println(stopsecondswd);  // used for debugging
      if(nowseconds >= stopsecondswd){
        Blynk.virtualWrite(V51, 0);
        
        if(nowseconds <= stopsecondswd + 90){   // 90s on 60s timer ensures 1 trigger command is sent
          
         Blynk.virtualWrite(V51, 0);
          // code here to switch the relay OFF
        }              
      }
      else{
        if(nowseconds >= startsecondswd){  
          Blynk.virtualWrite(V51, 1);
          
         
        }          
      }
      }
      else
      {
       // nothing to do today, check again in 30 SECONDS time    
      }
      }
}



BLYNK_WRITE(V53)//Gardenlight 
{  
  if (manual==1)
      { 
      sprintf(Date, "%02d/%02d/%04d",  day(), month(), year());
      sprintf(Time, "%02d:%02d:%02d", hour(), minute(), second());
    
      TimeInputParam t(param);
      Serial.println(Time);
      Serial.println(Date);
    
      int dayadjustment = -1;  
      if(weekday() == 1){
        dayadjustment =  6; // needed for Sunday, Time library is day 1 and Blynk is day 7
      }
      if(t.isWeekdaySelected(weekday() + dayadjustment)){ //Time library starts week on Sunday, Blynk on Monday
            
      nowseconds = ((hour() * 3600) + (minute() * 60) + second());
      startsecondswd = (t.getStartHour() * 3600) + (t.getStartMinute() * 60);
      Serial.println(startsecondswd);  // used for debugging
      if(nowseconds >= startsecondswd){    
;



        if(nowseconds <= startsecondswd + 90){    // 90s on 60s timer ensures 1 trigger command is sent
           Blynk.virtualWrite(V52, 1);



      

        }
       
        }
        
          // code here to switch the relay ON
              
      }
      
      else
      {
      }
      stopsecondswd = (t.getStopHour() * 3600) + (t.getStopMinute() * 60);
      Serial.println(stopsecondswd);  // used for debugging
      if(nowseconds >= stopsecondswd){
        Blynk.virtualWrite(V52, 0);
        
        if(nowseconds <= stopsecondswd + 90){   // 90s on 60s timer ensures 1 trigger command is sent
          
         Blynk.virtualWrite(V52, 0);
          // code here to switch the relay OFF
        }              
      }
      else{
        if(nowseconds >= startsecondswd){  
          Blynk.virtualWrite(V52, 1);
          
         
        }          
      }
    }
    else
    {
     // nothing to do today, check again in 30 SECONDS time    
    }
  }




void syncRelay()
{
  Blynk.syncAll();
  
  Serial.println("sync relay");
}


void showCurrentTime()
{
  String CurrentDate = String(day()) + '-' + monthShortStr(month()) + '-' + year();
  String CurrentTime = String(hour()) + ':' + minute() + ':' + second();
  String formattedDate = CurrentDate + String(" | ") + CurrentTime;
  Blynk.virtualWrite(V11,formattedDate);
}




  void sunrise() {
  
  // total sunrise length, in minutes
  static const uint8_t sunriseLength = 10;

  // how often (in seconds) should the heat color increase?
  // for the default of 30 minutes, this should be about every 7 seconds
  // 7 seconds x 256 gradient steps = 1,792 seconds = ~30 minutes
  static const uint8_t interval = (sunriseLength * 60) / 256;

  // current gradient palette color index
  static uint8_t heatIndex = 0; // start out at 0

  // HeatColors_p is a gradient palette built in to FastLED
  // that fades from black to red, orange, yellow, white
  // feel free to use another palette or define your own custom one
  CRGB color = ColorFromPalette(HeatColors_p, heatIndex);

  // fill the entire strip with the current color
  fill_solid(leds, NUM_LEDS, color);

  // slowly increase the heat
  EVERY_N_SECONDS(interval) {
    // stop incrementing at 255, we don't want to overflow back to 0
    if(heatIndex < 255) {
      heatIndex++;
    }
  }
}



void loop() 
{
  Blynk.run();
  timer.run();

  FastLED.show();
}

Some description of what each of the widgets is intended to do, and what does and doesn’t work, would help people look at your code and figure-out what might be wrong.

I would expect to see some sort of time input, for you to set the alarm time, and a timer that regularly checked the value from an RTC widget against the time that is set. Once the RTC time matches or exceeds the alarm time then you trigger whatever LED process it is that you want.

I can see some of these elements within the code, but not all (although I haven’t studied it in great detail, because of the missing high-level overview information from you.

Pete.

Hi Peter Thanks for answering.
The sketch is based on this example Timer - scheduler for gardenlight and fauntain (using eventor)
Then you see the V ports on the widgets is that what you need to know?
I ha a neopixels strip on Pin 6 and a normaal on of led on 5 ( this works with timer and button)
But the second part is not working the sunrise. I dont know where i added that sunrise start.
What doe you need on information ?

Regards Leo

So you’re using the Eventor widget to trigger these actions?
I’m an iOS user and Eventor thankfully isn’t available in iOS, so I do this sort of thing the ‘proper’ way in code, using virtual pins.

I doubt that anyone will be able to help you unless you share the details of your Eventor settings.

Pete.