BLYNK
HOME       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

How works Time Input when day is selected?

Hello guys
I managed to understand how the Time Input Widget works to select hour, minute and second, both start and stop. But I don’t understand how to make that works depending on the selected days (Let’s say only Monday and Wednesday) How works Time Input Widget in that case? is it kind different?
Thanks in advance

Have you studied the examples?

Pete.

Hello Pete.
Just a little, I was trying to understand how it works based on this code:

BLYNK_WRITE(V1) {
  TimeInputParam t(param);
  int Avvio1;
  unsigned int nowseconds = ((hour() * 3600) + (minute() * 60) + second());
  unsigned int startseconds = (t.getStartHour() * 3600) + (t.getStartMinute() * 60);
  unsigned int stopseconds = (t.getStopHour() * 3600) + (t.getStopMinute() * 60);
  int dayadjustment = -1;
  if (weekday() == 1) {
    dayadjustment = 6;
  }
  if (t.isWeekdaySelected((weekday() + dayadjustment))) {
    //Schedule is ACTIVE today
    if (nowseconds >= startseconds - 31 && nowseconds <= startseconds + 31 ) {
      led1.on();  // turn on virtual LED
      Avvio1 = Avvio = 1;
     // Serial.println("Schedule 1 started");
    }
    if (nowseconds >= stopseconds - 31 && nowseconds <= stopseconds + 31 ) {
      led1.off();   // turn OFF virtual LED
      Avvio = 0;
      //Serial.println("Schedule 1 finished");
      //Serial.println(Avvio);
    }
  }
}

But if I’m honest, I don’t know how implement that

Try studying this example:
https://examples.blynk.cc/?board=ESP8266&shield=ESP8266%20WiFi&example=Widgets%2FTimeInput%2FAdvancedTimeInput

Pete.

1 Like

Fortunately I am not the only one who does not understand the time input :joy:
It could be the most useful tool but simultaneously it is also the most difficult widget to understand
If I find out how it works, I permise to tell you :wink:

The Time Input Widget is simply that… it takes your input settings, makes them available to your code and does nothing more :stuck_out_tongue:

It requires much logic code to make use of all those settings, more than other widgets, with exception of the rarely used Music Player Widget which is much the same… looks fancy but does nothing more than pass on which button is pressed :notes:

You’re right, it is very useful, but hard to learn how it works, and thanks man, if you find how works, I would be very grateful :smile:

Why Blynk did this Widget very hard to learn? That’s not fair

After think a lot, I finally got it to work as expected

Your guess is as good as mine :smiley: But I do feel that Blynk’s initial advertising of “no coding required” was pure marketing outgassing to bring in the unwashed masses :laughing:

If I am honest, that initial marketing was not bad, because without it, I wouldn’t be here learning about this :smile:

So true!.. I also responded the same way as I was looking for a simple GUI for Arduinos… but quickly learned how to code in order to do things the way I wanted.

Marketing doesn’t have to be honest to work :stuck_out_tongue: In fact, it seems to work best the other way around… go fig :wink: