Arduino RTC timer sketch

Something somewhat useful, and the main reason I started playing the the DS1307 real time clock, was to be able to accurately control events based on the current time. In the same way you can get a simple plug-in timer to turn on or off an appliance depending on the time, I wanted to be able to do the same with the Arduino.

I wrote a fairly wide-ranging RTC timer sketch that I posted to Github that will allow you to execute a given block of code or function based on a start and end time that you specify. Although the default sketch is simply turning on and off an LED connected to digital pin 2, there’s probably a lot of situations beyond just turning a light on or off that this could be used for.

Hopefully it’s useful, and it’s definitely something I’ll be incorporating in to other programs I’ll be writing 🙂

About

Senior Content Development for Microsoft writing about Azure virtual machines. Occasionally I play video games.

Posted in ardunio, my projects
3 comments on “Arduino RTC timer sketch
  1. Maik says:
    Safari 8536.25 iOS 6.1

    Hi,

    I like your Sketch very much! But I’am searching for a possibility to save battery power because i’am running this Sketch on a battery. Do you know a possibility and how to include in your Code?
    Maik

  2. Tim says:
    Safari 601.1.56 Mac OS X 10.10.5

    I have a 4 channel relay. I succeeded in using your sketch to turn on/off one of the relays. Would be grateful for any thoughts you might have on adapting the code to accommodate the other three relays.

  3. player3 says:
    Google Chrome 48.0.2564.116 Windows 7

    Thank you!

Leave a Reply

Your email address will not be published. Required fields are marked *

*

About Me

Iain Foulds, 33 years old. Originally from England, now living in Seattle. I currently work as a Senior Content Developer for Microsoft writing about Azure VMs. Gamer. Very passionate about photography. Comments and opinions expressed here are my own. More...

Categories

Archives