I have a problem with the module rtc, I'm trying to connect it directly via pins to Arduino! I tried to set the following parameters in the setup:
- Code: Select all
// Date and time functions using a DS1307 RTC connected via I2C and Wire lib
#include <Wire.h>
#include <RTClib.h>
RTC_DS1307 RTC;
void setup () {
Serial.begin(9600);
Wire.begin();
RTC.begin();
pinMode(A3,OUTPUT);
pinMode(A2,OUTPUT);
digitalWrite(A3,HIGH);
digitalWrite(A2,LOW);
if (! RTC.isrunning()) {
Serial.println("RTC is NOT running!");
// following line sets the RTC to the date & time this sketch was compiled
RTC.adjust(DateTime(12/06/2012, 10:30:00));
}
pinMode(13,OUTPUT);
}
void loop () {
DateTime now = RTC.now();
Serial.println(now.minute(),DEC);
if(now.hour()==10 && now.minute()==26){
Serial.println("sono le ore: 10:26");
}
Serial.print(now.year(), DEC);
Serial.print('/');
if(now.month()<10){
Serial.print("0");
}
Serial.print(now.month(), DEC);
Serial.print('/');
if(now.day()<10){
Serial.print("0");
}
Serial.print(now.day(), DEC);
Serial.print(' ');
if(now.hour()<10){
Serial.print("0");
}
Serial.print(now.hour(), DEC);
Serial.print(':');
if(now.minute()<10){
Serial.print("0");
}
Serial.print(now.minute(), DEC);
Serial.print(':');
if(now.second()<10){
Serial.print("0");
}
Serial.print(now.second(), DEC);
Serial.println();
delay(1000);
}
but Arduino seems not work! it seems as if the serial port does not work.
The LED blinks only when I deadlift rtc module, otherwise it is turned on and fixed.
In any case, both with and without the rtc module, the monitor serial does not show anything! What is wrong?
Thanks

