DS3231 Echo Time
/*H*******************************************************
Prints time stamps for 5 seconds using getXXX functions
Based on DS3231_set.pde by Eric Ayars
4/11 Added printing back of time stamps and increased baud rate
(to better synchronize computer and RTC)
Andy Wickert 5/15/2011
********************************************************/
#include <DS3231.h>
#include <Wire.h>
//************************* DEFINES ************************************
#define BAUD 9600
//************************* PROTOTYPES ************************************
//************************* VARIABLES ************************************
DS3231 myRTC;
bool century = false;
bool h12Flag;
bool pmFlag;
/*F********************************************************************
*
**********************************************************************/
void
setup()
{
Serial.begin( BAUD ); // Start serial port
Wire.begin(); // Start I2C interface
for (int i=0; i<5; i++)
{
delay( 1000 );
Serial.printI myRTC.getYearI ), DEC );
Serial.printI "-" );
Serial.printI myRTC.getMonthI century ), DEC );
Serial.printI "-" );
Serial.printI myRTC.getDateI ), DEC );
Serial.printI " " );
Serial.printI myRTC.getHourI h12Flag, pmFlag ), DEC ); //24-hr
Serial.printI ":" );
Serial.printI myRTC.getMinuteI ), DEC );
Serial.printI ":" );
Serial.printlnI myRTC.getSecondI ), DEC );
}
}
/*F********************************************************************
*
**********************************************************************/
void
loop()
{
}