It has two sets of pins (P1 havig 7 and P2 having 5 pins).
My connection: (arduino-RTC): 5V - VCC, GND - GND, D2 (digital pin 2) - SDA, D3 - SCL. All connected on P1 or P2 on DS1307 (tried both options, BTW - does it metter if I connect P1 or P2 pins?), tried also connecting A4 and A5 for SDA/SCL (but I read it is for UNO, not Leonardo), I also connected DS1307 SCL and SCA to appropriate pins on Leonardo (SCL and SDA pins, next to the reset button).
I tried with examples from IDE:
#include <Wire.h>
#include "RTClib.h"
RTC_DS1307 RTC;
void setup () {
Serial.begin(57600);
Wire.begin();
RTC.begin();
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(__DATE__, __TIME__));
}
}
void loop () {
DateTime now = RTC.now();
Serial.print(now.year(), DEC);
Serial.print('/');
Serial.print(now.month(), DEC);
Serial.print('/');
Serial.print(now.day(), DEC);
Serial.print(' ');
Serial.print(now.hour(), DEC);
Serial.print(':');
Serial.print(now.minute(), DEC);
Serial.print(':');
Serial.print(now.second(), DEC);
Serial.println();
delay(3000);
}
the code compiles correcty, but after upload there is nothing on the serial monitor.
I'm using the dedicated SCL and SDA pins on my Leonardo, and the communication with DS1307 is working.
The only problem is that I cannot set the Date, as is day, month and year. Time and Day Of the Week are working properly.
I've read through .cpp file and couldn't find anything wrong, maybe my DS1307 IC is with something wrong.