J ai compris ma boulette ... une histoire de branchement !
En fait sur le Leonardo, il ne faut pas utiliser SCL/SDA s'il y a le LCD sur les pin 2,3,4,5 car la lib RTC utilise les pin 2 & 3 !
Si je décale le LCD en 4,5,6,7 et que je branche le module RTC en 2,3, ca marche nickel !
Le bon code pour ceux qui veulent essayer :
#include <LiquidCrystal.h>
#include <Wire.h>
#include "RTClib.h"
RTC_DS1307 RTC;
// initialize the library with the numbers of the interface pins
//LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
LiquidCrystal lcd(12, 11, 7, 6, 5, 4);
void setup() {
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
// Print a message to the LCD.
lcd.print("hello, world!");
Wire.begin();
RTC.begin();
if (! RTC.isrunning()) {
RTC.adjust(DateTime(__DATE__, __TIME__));
}
}
void loop() {
// set the cursor to column 0, line 1
// (note: line 1 is the second row, since counting begins with 0):
lcd.setCursor(0, 1);
// print the number of seconds since reset:
//lcd.print(millis()/1000);
DateTime now = RTC.now();
lcd.print(now.year()-2000, DEC);
lcd.print('/');
lcd.print(now.month(), DEC);
lcd.print('/');
lcd.print(now.day(), DEC);
lcd.print(' ');
lcd.print(now.hour(), DEC);
lcd.print(':');
lcd.print(now.minute(), DEC);
lcd.print(':');
lcd.print(now.second(), DEC);
lcd.println();
}