Bonjour les amis,
J'ai qq soucis j'aimerai bien afficher l'heure sur mon LCD avec ce code, lorsque je fait les test de compil j'ai le message "Erreur de compilation pour la carte Arduino/Genuino Uno":
#include <LiquidCrystal.h>
#include <DS1302RTC.h>
// Init the DS1302
// Set pins: CE, IO,CLK
DS1302RTC RTC(6, 7, 8);
// Init the LCD
// initialize the library with the numbers of the interface pins
// lcd(RS, E, d4, d5, d6, d7)
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
void setup()
{
// Setup LCD to 16x2 characters
lcd.begin(16, 2);
// Activate RTC module
digitalWrite(DS1302_GND_PIN, LOW);
pinMode(DS1302_GND_PIN, OUTPUT);
digitalWrite(DS1302_VCC_PIN, HIGH);
pinMode(DS1302_VCC_PIN, OUTPUT);
lcd.print("RTC activated");
delay(500);
lcd.clear();
if (RTC.haltRTC())
lcd.print("Clock stopped!");
else
lcd.print("Clock working.");
lcd.setCursor(0,1);
if (RTC.writeEN())
lcd.print("Write allowed.");
else
lcd.print("Write protected.");
delay ( 2000 );
// Setup time library
lcd.clear();
lcd.print("RTC Sync");
setSyncProvider(RTC.get); // the function to get the time from the RTC
if(timeStatus() == timeSet)
lcd.print(" Ok!");
else
lcd.print(" FAIL!");
delay ( 2000 );
lcd.clear();
}
void loop()
{
static int sday = 0; // Saved day number for change check
// Display time centered on the upper line
lcd.setCursor(3, 0);
print2digits(hour());
lcd.print(" ");
print2digits(minute());
lcd.print(" ");
print2digits(second());
// Update in 00:00:00 hour only
if(sday != day()) {
// Display abbreviated Day-of-Week in the lower left corner
lcd.setCursor(0, 1);
lcd.print(dayShortStr(weekday()));
// Display date in the lower right corner
lcd.setCursor(5, 1);
lcd.print(" ");
print2digits(day());
lcd.print("/");
print2digits(month());
lcd.print("/");
lcd.print(year());
}
// Warning!
if(timeStatus() != timeSet) {
lcd.setCursor(0, 1);
lcd.print(F("RTC ERROR: SYNC!"));
}
// Save day number
sday = day();
// Wait small time before repeating
delay (100);
}
void print2digits(int number) {
if (number >= 0 && number < 10) {
lcd.write('_');
}
lcd.print(number);
}
J'ai vérifier toute la connectique, ajuster les N° de pins en fonction des mes branchements...
Le message apparait même que la carte ne soit pas connectée bizar, bizar...
Par contre j'ai un doute que le code soit adapter à la UNO R3???
Pour info j'ai essayais de changer le type de carte par une "Arduino/Genuino Mega or Mega 2560" c'est toujours la même chose....
je ne sais pas se qui cloche ?????
Votre aide et avis seront bien accueillis.
Bien cordialement à vous.