Skip to content

TestBatteryBackup.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

This sketch will only work correctly when using a MCP7940N. The Battery pin should be connect to the power supply. Once the program is started it displays the time and a power failure is simulated by disconnecting the MCP7940's main power pin. The program detects that there is a power failure (since the I2C communications stop working) and when power to the MCP7940 is restored it will read the power failure and power restore datetimes and display them.

Clone this wiki locally