Xender wrote:Hello,
is it possible to setup different time for saturday and sunday for lights on and off?
thx
There is not currently a simple way to do it yet. There are 2 ways to handle it: 1. hardcode the on/off times for the weekend 2. create your own internal memory values and use those (but not be able to change them via the setup menus only through the wifi interface).
Here is how you would do both:
1. Inside your PDE loop function, you could do this:
Code: Select all
void loop()
{
// ... other functions here
if ( (weekday() == 1) || (weekday() == 7) ) // Sunday or Saturday
{
ReefAngel.StandardLights(Port4, 11, 0, 20, 0); // Weekend schedule
} else
{
ReefAngel.StandardLights(Port4, 8, 0, 18, 0); // Weekday schedule
}
}
2. Use the same checks, only instead of the hardcoded values, you would use the memory functions:
Code: Select all
void loop()
{
// ... other functions
if ( (weekday() == 1) || (weekday() == 7) ) // Sunday or Saturday
{
// 0 - on hour, 1 - on minute, 2 - off hour, 3 - off minute
ReefAngel.StandardLights(Port4, InternalMemory.read(0), InternalMemory.read(1), InternalMemory.read(2), InternalMemory.read(3)); // Weekend schedule
} else
{
ReefAngel.StandardLights(Port4); // Weekday schedule (use standard internal memory values)
}
}
I would also suggest that you update the values in memory FIRST before you upload your code. Otherwise you will be using values that are "uninitialized" (which is just 255 and you will get unexpected responses values being used for the times).
You can pick any memory location you want, but i would suggest avoiding the 700-900 range because those ranges already are mostly filled up. I'm planning on using more memory locations for other future stuff too. So if you keep it in the 0 - 200 range, you should be perfectly fine. The locations mentioned above will only be reading a byte. So for the memory reading/writing, you will be using byte storage (which is /mb and only uses 1 block of memory). I would suggest using my status application to update the values as you need to.
http://forum.reefangel.com/viewtopic.php?f=8&t=246
Even though I list it as an alpha release, it's still fully functional and works great. I should probably change it to be a Beta release though.
These solutions should both work equally well for you. It just depends on whether you want to have hard coded values or values that you can change easily via the wifi interface. Personally, you will probably want to go with option #2 unless you never want to change the values without uploading new code.
curt