Download Electronic Bricks Cookbook

Transcript
Connect the RTC module to the IIC connector on chassis and program the code below,
then you will get a clock.
#include <WProgram.h>
#include <Wire.h>
#include <DS1307.h>
// written by mattt on the Arduino forum and modified by D. Sjunnesson
void setup()
{
Serial.begin(9600);
RTC.stop();
RTC.set(DS1307_SEC,1);
RTC.set(DS1307_MIN,23);
RTC.set(DS1307_HR,12);
RTC.set(DS1307_DOW,4);
RTC.set(DS1307_DATE,5);
RTC.set(DS1307_MTH,3);
RTC.set(DS1307_YR,9);
RTC.start();
//set the seconds
//set the minutes
//set the hours
//set the day of the week
//set the date
//set the month
//set the year
Page 23 of 27
8/23/2011