Skip to content

SetAlarms.ino

Arnd edited this page Dec 11, 2020 · 2 revisions

Sample Arduino sketch to demonstrate setting and using the two alarms on the MCP7940. For a detailed breadboard setup description see the SetAndCalibrate.ino page.

Program Overview

The sketch sets alarm 0 to trigger whenever the seconds are "00" (i.e. every minute) while alarm 1 is set to trigger at exactly 1 minute after the program initialized.
The main loop displays when either alarm goes off and resets alarm 1 so that it goes off again one minute later. The sketch makes use of the sprintf() function to print out the date/time since this function allows formatting leading zeroes, which the Serial.print() function does not.

Clone this wiki locally