Nanoshield_RTC¶
This is the Arduino software library to access the RTC functionality of the RTCMem Nanoshield.
- Source code: https://github.com/circuitar/Nanoshield_RTC
- Documentation: http://nanoshield-rtc.readthedocs.org/
- Reference board: `Nanoshield RTCMem`_ from Circuitar_
Library features include:
- Read date and time from the RTCMem Nanoshield
- Write date and time to the RTCMem Nanoshield
To install, just click Download ZIP and install it using Sketch > Include Library... > Add .ZIP Library in the Arduino IDE.
Class Documentation¶
-
class
DS1307
¶ Inherits from DS3231
Public Functions
-
bool
begin
(uint8_t clkout = DS1307_CLKOUT_32768_HZ)¶ Initializes the DS1307 object.
Disable all alarms and enable both the clkout and 1Hz square wave output.
- DS1307_CLKOUT_4096_HZ
- DS1307_CLKOUT_8192_HZ
- DS1307_CLKOUT_32768_HZ
- Return
- True on success. False if there were errors.
- Parameters
clkout
-Output clock. Default at 32768. Use one of these:
- DS1307_CLKOUT_1_HZ
-
bool
start
()¶ Starts the RTC.
- Return
- True on success. False if there were errors.
-
bool
stop
()¶ Stops the RTC.
- Return
- True on success. False if there were errors.
-
bool
Warning
doxygenclass: Unable to find project ‘DS3231’ in breathe_projects dictionary
-
class
Nanoshield_RTC
¶ Subclassed by DS3231
Public Functions
-
Nanoshield_RTC
()¶ Constructor.
Creates the object to access the Nanoshield RTC.
-
bool
begin
(uint8_t clkout = NANOSHIELD_RTC_CLKOUT_1_HZ)¶ Initializes the Nanoshield RTC object.
Disables all alarms and set the clock output to clkout.
- Return
- True on success. False if there were errors.
- Parameters
clkout
-The clock output. Use one of these:
- NANOSHIELD_RTC_CLKOUT_32768_HZ
- NANOSHIELD_RTC_CLKOUT_1024_HZ
- NANOSHIELD_RTC_CLKOUT_32_HZ
- NANOSHIELD_RTC_CLKOUT_1_HZ
-
bool
start
()¶ Starts the RTC.
- Return
- True on success. False if there were errors.
-
bool
stop
()¶ Stops the RTC.
- Return
- True on success. False if there were errors.
-
bool
write
(int sec, int min, int hour, int day, int wday, int mon, int year)¶ Sets the RTC date and time.
- Return
- True on success. False if there were errors.
- Parameters
sec
-Seconds from 0 to 59.
min
-Minutes from 0 to 59.
hour
-Hour from 0 to 23.
day
-Day from 1 to 31.
wday
-Weekday from 0 to 6 as Sunday to Saturday respectively.
mon
-Month from 1 to 12.
year
-Year (4 digits).
-
bool
writeSeconds
(int sec)¶ Sets the RTC seconds.
- Return
- True on success. False if there were errors.
- Parameters
sec
-Seconds from 0 to 59.
-
bool
writeMinutes
(int min)¶ Sets the RTC minutes.
- Return
- True on success. False if there were errors.
- Parameters
min
-Minutes from 0 to 59.
-
bool
writeHours
(int hour)¶ Sets the RTC hour.
- Return
- True on success. False if there were errors.
- Parameters
hour
-Hour from 0 to 23.
-
bool
writeDay
(int day)¶ Sets the RTC day.
- Return
- True on success. False if there were errors.
- Parameters
day
-Day from 1 to 31.
-
bool
writeWeekday
(int wday)¶ Sets the RTC weekday.
- Return
- True on success. False if there were errors.
- Parameters
wday
-Weekday from 0 to 6 as Sunday to Saturday respectively.
-
bool
writeMonth
(int mon)¶ Sets the RTC month.
- Return
- True on success. False if there were errors.
- Parameters
mon
-Month from 1 to 12.
-
bool
writeYear
(int year)¶ Sets the RTC year.
- Return
- True on success. False if there were errors.
- Parameters
year
-Year (4 digits).
-
bool
read
()¶ Read datetime from RTC and stores internally.
The datetime can be accessed with getters or getTime, that returns a timestamp string.
- Return
- True on success. False if there were errors.
- See
-
void
getTime
(char *time)¶ Get a timestamp of the last reading.
The timestamp is in format YYYY-MM-DD HH:MM:SS.
- Parameters
time
-Output pointer to timestamp.
-
int
getSeconds
()¶ Gets the seconds of the last reading.
- Return
- Seconds of the last reading.
-
int
getMinutes
()¶ Gets the minutes of the last reading.
- Return
- Minutes of the last reading.
-
int
getHours
()¶ Gets the hour of the last reading.
- Return
- Hour of the last reading.
-
int
getDay
()¶ Gets the day of the last reading.
- Return
- Day of the last reading.
-
int
getWeekday
()¶ Gets the weekday of the last reading.
- Return
- Weekday of the last reading.
-
int
getMonth
()¶ Gets the month of the last reading.
- Return
- Month of the last reading.
-
int
getYear
()¶ Gets the year of the last reading.
- Return
- Year of the last reading.
-
This documentation was built using ArduinoDocs.