Giter Club home page Giter Club logo

ds1305-arduino's Introduction

Arduino library for Dallas Semiconductor DS1305 real time clock

This library provides support for the DS1305 real time clock for the Arduino platform using the SPI bus.

To use, copy the entire contents of this folder to a new directory sketches/libraries/DS1305, where sketches is your existing Arduino sketches directory. After copying the files, if your Arduino IDE is running, you must restart it.

To use the library, you should find DS1305 available under Sketch -> Import Library in the IDE.

To use, create a new clock object:

	DS1305 clk;

Initialize in your setup() method, providing the digital IO line that you wired the chip enable to, in this case the SS line:

	clk.init(SS);

Initialization will update the chip settings to enable the oscillator and remove write protection.

From here on you can use the various methods available to interact with the chip's clock, alarms and control functions.

Two struct based types are used to represent clock (ds1305time) and alarm (ds1305alarm) data.

Please note that the clock can be used in 24 hour or 12 hour mode. The default mode of operation for the DS1305 library is to use the clock in 24 hour mode. To use the clock in 12 hour mode create the object as "DS1305 clk(false)". This controls the way times are written to the clock. For example, if you use the 12 hour mode, make sure and provide the hours in the "hours12" and "ampm" elements of the ds1305time and ds1305alarm structures. ampm should be either 'A' or 'P'.

When reading values from the clock, the library will automatically detect the mode it's running in and provide both the 24 hour hour (.hours) and the 12 hour hour (.hours12 / .ampm) back in the structure - so you can always use both values in the responses returned from the clock.

When using alarms, you can use the DS1305_ANY constant for the hours, minutes, seconds or day or week to indicate that the alarm should triggeron any matching value for that field.

Example sketches are provided with the library. Check out File->Examples->DS1305->clock.

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.