Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added Chronodot example and README file

  • Loading branch information...
commit 7d5764e1e2785b0f224335c9a0152b82c8110743 1 parent ecbe1ed
@MrAlvin authored
View
46 README.txt
@@ -0,0 +1,46 @@
+A Real Time Clock (RTC) Library for DS1307 compatible chips.
+-------------------------------------------------------------
+
+Also inclues DS1307, DS3231 (Chronodot) and DS3234-SPI specific code
+
+
+Basic functions (see examples of how to use):
+ .begin
+ .adjust
+ .isrunning
+ .now
+
+DS1307 specific functions:
+ .readMemory
+ .writeMemory
+
+DS3231 specific functions:
+ .getTemperature
+ .getA1Time
+ .getA2Time
+ .setA1Time
+ .setAlarm1Simple
+ .setA2Time
+ .setAlarm2Simple
+ .turnOnAlarm
+ .turnOffAlarm
+ .checkAlarmEnabled
+ .checkIfAlarm
+
+
+
+Credits:
+---------
+
+- Code by JeeLabs http://news.jeelabs.org/code/
+ Released to the public domain! Enjoy!
+
+- Optimized DS1307 code by ADAfruit and others
+
+- Merged read/write RAM memory functions from: github.com/dmalec/RTClib by MrAlvin 2012-02-27
+- Merged DS3231 & DS3234 functions from: github/coobro/RTClib by MrAlvin 2012-02-27
+ Alarm code for DS3231 (Chronodot) heavily used/modified from Eric Ayars DS3231 library by Coobro
+ Eric Ayars code is located at: http://hacks.ayars.org/2011/04/ds3231-real-time-clock.html
+
+- Chronodot keyword added by MrAlvin 2012-02-28
+
View
5 RTClib.h
@@ -1,6 +1,7 @@
// Code by JeeLabs http://news.jeelabs.org/code/
// Released to the public domain! Enjoy!
-
+
+// Chronodot keyword added bt MrAlvin 2012-02-28
// Merged read/write RAM memory functions from: github.com/dmalec/RTClib by MrAlvin 2012-02-27
// Merged DS3231 & DS3234 functions from: github/coobro/RTClib by MrAlvin 2012-02-27
@@ -11,7 +12,7 @@
#ifndef __RTCLIB_H__
#define __RTCLIB_H__
-
+#define Chronodot RTC_DS3231
// Simple general-purpose date/time class (no TZ / DST / leap second handling!)
class DateTime {
View
49 examples/Chronodot/Chronodot.pde
@@ -0,0 +1,49 @@
+// Date, Time and Alarm functions using a Chronodot (DS3231) RTC connected via I2C and Wire lib
+
+#include <Wire.h>
+#include <SPI.h> // not used here, but needed to prevent a RTClib compile error
+#include <RTClib.h>
+
+Chronodot RTC;
+
+void setup () {
+ Serial.begin(57600);
+ Wire.begin();
+ RTC.begin();
+
+ RTC.adjust(DateTime(__DATE__, __TIME__));
+ if (! RTC.isrunning()) {
+ Serial.println("RTC is NOT running!");
+ // following line sets the RTC to the date & time this sketch was compiled
+ RTC.adjust(DateTime(__DATE__, __TIME__));
+ }
+ DateTime now = RTC.now();
+ RTC.setAlarm1Simple(21, 58);
+ RTC.turnOnAlarm(1);
+ if (RTC.checkAlarmEnabled(1)) {
+ Serial.println("Alarm Enabled");
+ }
+}
+
+void loop () {
+ DateTime now = RTC.now();
+
+ Serial.print(now.year(), DEC);
+ Serial.print('/');
+ Serial.print(now.month(), DEC);
+ Serial.print('/');
+ Serial.print(now.day(), DEC);
+ Serial.print(' ');
+ Serial.print(now.hour(), DEC);
+ Serial.print(':');
+ Serial.print(now.minute(), DEC);
+ Serial.print(':');
+ Serial.print(now.second(), DEC);
+ Serial.println();
+
+ if (RTC.checkIfAlarm(1)) {
+ Serial.println("Alarm Triggered");
+ }
+ Serial.println();
+ delay(3000);
+}
View
1  keywords.txt
@@ -11,6 +11,7 @@ RTC_DS1307 KEYWORD1
RTC_DS3231 KEYWORD1
RTC_DS3234 KEYWORD1
RTC_Millis KEYWORD1
+Chronodot KEYWORD1
#######################################
# Methods and Functions (KEYWORD2)
Please sign in to comment.
Something went wrong with that request. Please try again.