k2008

C code posted by MiGaNuTs
created at 29 Jan 19:43

Edit | Back
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include <WProgram.h>
#include <Wire.h>
#include <DS1307.h>

int rtc[7];
int ledPin =  13;
void setup()
{
  DDRC|=_BV(2) |_BV(3);  // POWER:Vcc Gnd
  PORTC |=_BV(3);  // VCC PINC3
  pinMode(ledPin, OUTPUT);  
  Serial.begin(9600);
  /*
  RTC.stop();
  RTC.set(DS1307_SEC,1);
  RTC.set(DS1307_MIN,42);
  RTC.set(DS1307_HR,20);
  RTC.set(DS1307_DOW,5);
  RTC.set(DS1307_DATE,12);
  RTC.set(DS1307_MTH,9);
  RTC.set(DS1307_YR,11);
  RTC.start();
  */
}

void loop()
{
  RTC.get(rtc,true);

  for(int i=0; i<7; i++)
  {
    Serial.print(rtc[i]);
    Serial.print(" ");
  }
  Serial.println();
  digitalWrite(ledPin, HIGH); 
  delay(500);
  digitalWrite(ledPin, LOW);
  delay(500);
}
715 Bytes in 4 ms with coderay