Git Product home page Git Product logo

geekfactory / gfrtc Goto Github PK

View Code? Open in Web Editor NEW
2.0 3.0 1.0 49 KB

Library to interface DS1307 and DS3231 real time clock ICs with arduino

Home Page: https://www.geekfactory.mx/tutoriales-arduino/ds3231-el-reloj-en-tiempo-real-de-gran-precision-para-arduino/

License: GNU General Public License v3.0

C++ 100.00%
arduino arduino-library ds1307 ds1307-arduino ds3231 ds3231-arduino ds3231-library real-time-clock rtc time-date

gfrtc's Introduction

Geek Factory GFRTC Library

This is a library to read / write time and date information when using the very popular DS1307, DS3231 & DS3232 RTC chips from Dallas/maxim.

The library can provide time in standard structures or as a unix timestamp to cover a wide range of applications. Examples provide enough information to get started and the API is fully documented on the GFRTC.h file.

For more information regarding the basic usage and applications of this library please check the following website (spanish only, sorry):

https://www.geekfactory.mx/tutoriales-arduino/ds3231-el-reloj-en-tiempo-real-de-gran-precision-para-arduino/

Testing and evaluation of the chips was performed using the following modules:

Basic library usage

Just include the library header file. The library automatically creates an instance called "GFRTC" which exposes all the funcionality of the RTC chip.

#include <GFRTC.h>

In setup function call GFRTC.begin(true); This calls Wire.begin() (when the parameter pased to the funcion is set to true) to prepare the I2C interface if it is not done elsewhere.

GFRTC.begin(true);

And then use the read / write methods to get or set time information as required:

// structure to hold data from RTC
struct timelib_tm datetime;

// get date and time
if (GFRTC.read(datetime)) {
    // do something with date and time information now in struct
}

if (GFRTC.write(datetime)) {
    // write ok, print data sent to RTC
    Serial.print(F("Set date / time ok"));
} else {
    // error reading the RTC
  Serial.println(F("Cannot write RTC."));
}

Please see the examples folder for complete demo code.

Project objectives

  • Create a library that supports common RTC chips, including DS1307 & DS3231.
  • Access full functionality of the targetted RTC chips.
  • The library should provide support for setting / getting time on unix format.
  • Compatibility with our lightweight time management library

Supported devices

The library has been tested on the following hardware:

  • Arduino UNO
  • Arduino MEGA
  • Arduino MKR1000

Contact me

gfrtc's People

Contributors

geekfactory avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Forkers

m4k3r-org

gfrtc's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.