Etape 5: maintenant télécharger ici pour voir l’heure sur votre écran lcd.
* TimeRTC.pde
* exemple de code illustrant la bibliothèque avec horloge temps réel.
*
*/
#include < Time.h >
#include < Wire.h >
#include < DS1307RTC.h > / / une base bibliothèque DS1307 qui retourne le temps comme un time_t
#include < LiquidCrystal.h >
Innovente lcd (12, 11, 5, 4, 3, 2) ;
void setup() {}
LCD.Begin (16, 2) ;
Serial.Begin(9600) ;
setSyncProvider(RTC.get) ; la fonction permettant d’obtenir le temps du CCF
if(timeStatus()! = timeSet)
Serial.println ("Impossible de synchroniser avec le CCF") ;
d’autre
Serial.println ("CCF a définir l’heure système") ;
}
void loop()
{
digitalClockDisplay() ;
Delay(1000) ;
}
void digitalClockDisplay() {}
affichage de l’horloge numérique du temps
Serial.Print(Hour()) ;
printDigits(minute()) ;
printDigits(second()) ;
Serial.Print("") ;
Serial.Print(Day()) ;
Serial.Print("") ;
Serial.Print(month()) ;
Serial.Print("") ;
Serial.Print(Year()) ;
Serial.println() ;
lcd.setCursor (2, 0) ; Définir la position du curseur LCD (colonne, ligne)
LCD.Print(Hour()) ;
LCD.Print(":") ;
LCD.Print (minute()) ;
LCD.Print("") ;
LCD.Print(second()) ;
LCD.Print("") ;
LCD.Print("Uhr") ;
lcd.setCursor (3, 1) ; Définir la position du curseur LCD (colonne, ligne)
LCD.Print(Day()) ;
LCD.Print(".") ;
LCD.Print(month()) ;
LCD.Print(".") ;
LCD.Print(Year()) ;
Imprimer un texte à l’écran LCD
Retard pour lire le texte
Effacer l’affichage
}
void printDigits (int chiffres) {}
fonction d’utilité pour l’affichage de l’horloge numérique : tirages précédents du côlon et menant 0
Serial.Print(":") ;
if(digits < 10)
Serial.Print('0') ;
Serial.Print(digits) ;
}