SolarPostion Library

Hello, I am try to use Ken Willmott Solar Postion Library to tell if the sun is up or down to turn a light on.

my question is how can I turn the (pos.elevation, numDigits) into a usable variable I can do a simple if <=0 check on to see if it is up or down.

If I set Float Solar_elevation = (SolarPosition_t pos, int numDigits) it returns 3 (the numDigits)



if (pos.elevation < 0) do_something();`


float Solar_elevation = (SolarPosition_t pos, int numDigits) it returns 3 (the numDigits)

Correct. Look up "C/C++ comma operator" to learn why. Specific to the Serial.print case, the "3" is a function call argument that determines how many digits to print.

That sorted that problem now the rest

Thank You.

I'll know what i am doing one day

It seems a bit elaborate a project that an LDR and some control logic can do instead.

LDR is daylight saving proof, longitude proof.

Tom... :smiley: :+1: :coffee: :australia:

Note that the sky is quite light when the center of the sun is on the horizon (elevation = 0°). You may want to check for civil (-9°), nautical (-12°) or astronomical (-18°) twilight.

Thanks John thats good to know

Who says it does have an LDR too......


What is the scope of your project?
You just say you want to turn a light ON/OFF, in response to the sun being above and below the horizon, what other stuff is the controller connected to?

Tom... :smiley: :+1: :coffee: :australia:

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.