-
Notifications
You must be signed in to change notification settings - Fork 138
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f305352
commit cd38d7f
Showing
2 changed files
with
42 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// Arduino DS3232RTC Library | ||
// https://github.com/JChristensen/DS3232RTC | ||
// Copyright (C) 2019 by Jack Christensen and licensed under | ||
// GNU GPL v3.0, https://www.gnu.org/licenses/gpl.html | ||
// | ||
// Simple example sketch that should work on any architecture. | ||
// For the AVR architecture, instantiating the DS3232RTC object | ||
// is redundant, but this is only for testing purposes. | ||
// | ||
// Jack Christensen 24Sep2019 | ||
|
||
#include <DS3232RTC.h> // https://github.com/JChristensen/DS3232RTC | ||
DS3232RTC myRTC; | ||
|
||
void setup() | ||
{ | ||
Serial.begin(115200); | ||
myRTC.begin(); | ||
} | ||
|
||
void loop() | ||
{ | ||
display(); | ||
delay(10000); | ||
} | ||
|
||
// display time, date, temperature | ||
void display() | ||
{ | ||
char buf[40]; | ||
time_t t = myRTC.get(); | ||
float celsius = myRTC.temperature() / 4.0; | ||
float fahrenheit = celsius * 9.0 / 5.0 + 32.0; | ||
sprintf(buf, "%.2d:%.2d:%.2d %.2d%s%d ", | ||
hour(t), minute(t), second(t), day(t), monthShortStr(month(t)), year(t)); | ||
Serial.print(buf); | ||
Serial.print(celsius); | ||
Serial.print("C "); | ||
Serial.print(fahrenheit); | ||
Serial.println("F"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
name=DS3232RTC | ||
version=1.2.8 | ||
version=1.2.9 | ||
author=Jack Christensen <[email protected]> | ||
maintainer=Jack Christensen <[email protected]> | ||
sentence=Arduino Library for Maxim Integrated DS3232 and DS3231 Real-Time Clocks. | ||
|