Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix sunrise.ino due to library change and auto-format code #11

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions examples/sunrise.ino
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@
#define OUR_timezone 180 // localtime with UTC difference in minutes

sunMoon sm;
DS3232RTC myRTC;

void printDate(time_t date) {
char buff[20];
sprintf(buff, "%2d-%02d-%4d %02d:%02d:%02d",
day(date), month(date), year(date), hour(date), minute(date), second(date));
day(date), month(date), year(date), hour(date), minute(date), second(date));
Serial.print(buff);
}

Expand All @@ -26,19 +27,20 @@ void setup() {
tm.Month = 8;
tm.Year = 2016 - 1970;
time_t s_date = makeTime(tm);


Serial.begin(9600);
setSyncProvider(RTC.get); // the function to get the time from the RTC
if (timeStatus() != timeSet)
myRTC.begin();
setSyncProvider(myRTC.get); // the function to get the time from the RTC
if (timeStatus() != timeSet)
Serial.println("Unable to sync with the RTC");
else
Serial.println("RTC has set the system time");
sm.init(OUR_timezone, OUR_latitude, OUR_longtitude);

Serial.print("Today is ");
printDate(RTC.get()); Serial.println("");
printDate(myRTC.get()); Serial.println("");

uint32_t jDay = sm.julianDay(); // Optional call
byte mDay = sm.moonDay();
time_t sRise = sm.sunRise();
Expand Down