#include <Wire.h>
#include <DS1307.h>
/*
about set time:
format: year,month,day,week,hour,min,sec
example: 14,03,25,02,13,55,10 2014.03.25 tuesday 13:55:10
*/
String comdata = "";
int mark=0;
//store the current time data
int rtc[7];
//store the set time data
byte rr[7];
//light pin
int ledPin = 13;
//initial light
void setup()
{
DDRC |= _BV(2) | _BV(3); // POWER:Vcc Gnd
PORTC |= _BV(3); // VCC PINC3
pinMode(ledPin, OUTPUT);
//initial baudrate
Serial.begin(9600);
//get current time
RTC.get(rtc, true);
//if time is wrong reset to default time
if (rtc[6] < 12) {
//stop rtc time
RTC.stop();
RTC.set(DS1307_SEC, 1);
RTC.set(DS1307_MIN, 27);
RTC.set(DS1307_HR, 01);
RTC.set(DS1307_DOW, 7);
Downloaded from
Downloaded from
Downloaded from