nplan / Arduino-Sun

An Arduino library for calculating sunrise and sunset times.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Arduino-Sun

Arduino library for calculating sunrise and sunset times.

Calculations are done using the sunrise equation.

The library takes current time in Unix Timestamp format and returns sunrise and sunset times for the ongoing day in the same format.

Use of Arduino Time library is recommended for timekeeping and converting between time formats.

Usage

// Initialize Sun object with local coordinates
Sun sun(46.24, 15.27);
// Current time (Unix Timestamp)
unsigned long tm = 1486908295
// Calculate time of sunrise for the ongoing day
unsigned long rise = sun.getRise(tm);
// Print results
Serial.print("Sun rises at: "); Serial.println(rise);

About

An Arduino library for calculating sunrise and sunset times.

License:GNU General Public License v3.0


Languages

Language:C++ 100.0%