22 lines
No EOL
697 B
C++
22 lines
No EOL
697 B
C++
#ifndef NaturalLight_h
|
|
#define NaturalLight_h
|
|
#include <Arduino.h>
|
|
|
|
#define SOLAR_EVENT_URL "http://api.sunrise-sunset.org/json?lat=%s&lng=%s&formatted=0"
|
|
|
|
class NaturalLight {
|
|
int _astronomicalTwilightBegin, _sunrise, _sunset, _astronomicalTwilightEnd, _timezoneOffset;
|
|
char _url[80];
|
|
String getSolarEventJson();
|
|
int getEpoch(const char *str);
|
|
int adjustForTimezone(int epoch);
|
|
|
|
public:
|
|
NaturalLight(char *lat, char *lon, int timezoneOffset);
|
|
void update();
|
|
int getAstronomicalTwilightBegin() { return _astronomicalTwilightBegin; }
|
|
int getSunrise() { return _sunrise; }
|
|
int getSunset() { return _sunset; }
|
|
int getAstronomicalTwilightEnd() { return _astronomicalTwilightEnd; }
|
|
};
|
|
#endif |