Skip to content

Commit c9e4315

Browse files
committed
Update example using getTimeFromSting and createWeeklyScheduleConfiguration
1 parent 941d65f commit c9e4315

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

examples/ArduinoIoTCloud-Schedule/ArduinoIoTCloud-Schedule.ino

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,19 @@ void setup() {
3636
ArduinoCloud.printDebugInfo();
3737

3838
/* Configure a schedule for LED. This should be done with Arduino create Scheduler widget */
39-
unsigned int startingFrom = 1635786000; /* From 01/11/2021 17:00 */
40-
unsigned int untilTo = startingFrom + ( DAYS * 28 ); /* To 29/11/2021 17:00 */
41-
unsigned int executionPeriod = MINUTES * 6; /* For 6 minutes */
42-
unsigned int scheduleConfiguration = 134217770; /* On monday wednesday and friday */
39+
unsigned int startingFrom = Schedule::getTimeFromString("2021 Nov 01 17:00:00"); /* From 01/11/2021 17:00 */
40+
unsigned int untilTo = startingFrom + ( DAYS * 28 ); /* To 29/11/2021 17:00 */
41+
unsigned int executionPeriod = MINUTES * 6; /* For 6 minutes */
42+
ScheduleWeeklyMask WeeklyMask = {
43+
ScheduleState::Inactive, /* Sunday -> Inactive */
44+
ScheduleState::Active, /* Monday -> Active */
45+
ScheduleState::Inactive, /* Tuesday -> Inactive */
46+
ScheduleState::Active, /* Wednesday -> Active */
47+
ScheduleState::Inactive, /* Thursday -> Inactive */
48+
ScheduleState::Active, /* Friday -> Active */
49+
ScheduleState::Inactive, /* Saturday -> Inactive */
50+
};
51+
unsigned int scheduleConfiguration = Schedule::createWeeklyScheduleConfiguration(WeeklyMask);
4352

4453
led = Schedule(startingFrom, untilTo, executionPeriod, scheduleConfiguration);
4554
}

0 commit comments

Comments
 (0)