Schedule Help

Hi

I have a project where I use the cayenne schedule to turn off and on a relay controlling lights. I also have other functions that require me to see if the lights are active before they are either turned on or off…

Is there any code for arduino that can be used to see if the schedule is running or not (lights on or off) ?

so for example: arduino will not turn the lights off via another function if the schedule time is not over.

any help would be great!

Thanks

this will depend on how you code your arduino.
for example you have scheduled to turn OFF light at 8:00 pm and have you have a button to turn it OFF too, but will only turn OFF when time is 8:00 pm then you can do it using:

if ((scheduled == 1) && (button == 1))
{
//turn OFF light.
}

where scheduled value is received from:

CAYENNE_IN_DEFAULT()
{
scheduled = getValue.asInt();
}

the above is just an example on how to do it, but you have to change it for your need as i did not understand your use case.

Thanks for your help, sorted it now using a global variable.

2 Likes