Re: Sunlocation?
Posted: Tue Jun 21, 2016 7:10 am
Where are the sunrise/sunset times coming from? I see GPS mentioned but don't understand where the information is being pulled from in the code.
Community discussion about Reef Angel Controllers and reefing related subjects
https://forum.reefangel.com/
Code: Select all
SunLocation *sl = new SunLocation();
Code: Select all
SunLocation sl;
I see reference to Great Barrier Reef in there but nothing else; is that just a reference? I dont have any issues using that lat/long, I was just curious. I'm not even going to try and make sense out of the moon library yet; that one left me googly eyed.lnevo wrote:When you run the Init function you set the coordinates. If you don't specify it will use GBR coordinates by default
I'd like to get this going but my lights dont dim to 0 (SBReef basic black boxes) so I use relays 5 and 6 for on/off functionality. Is there a way to tie that in so the relay and rise/set functions work together?lnevo wrote:Here is the excerpt from my code that references SunLocation. I think it's pretty self explanatory. One thing to keep in mind is that if sun.UseMemory==true, which is the default, then it will write the Daylight on/off times each day.
$ egrep -i 'SunLocation|sun\.' Wizard65.inoCode: Select all
#include <SunLocation.h> SunLocation sun; sun.Init(InternalMemory.read_int(Mem_I_Latitude), InternalMemory.read_int(Mem_I_Longitude)); sun.SetOffset(riseOffset,(acclDay*acclRiseOffset),setOffset,(-acclDay*acclSetOffset)); // Bahamas sun.CheckAndUpdate(); // Calculate today's Sunrise / Sunset tide.SetSpeed(PWMSlope(sun.GetRiseHour()-1,sun.GetRiseMinute(), sun.GetSetHour(),sun.GetSetMinute(),nightSpeed+tideMin,vtSpeed,120,nightSpeed+tideMin)); } else if (!sun.IsDaytime() && nightRF) { if (sun.IsDaytime() && (now()+offset)%repeat==0) { sprintf(buf, "%02d:%02d", sun.GetRiseHour(), sun.GetRiseMinute()); sprintf(buf, "%02d:%02d", sun.GetSetHour(), sun.GetSetMinute()); x+=36;