Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
main.cpp
00001 #include "mbed.h" 00002 #include "ds1338.h" 00003 00004 00005 char date [50]; 00006 int main() 00007 { 00008 struct tm time; //creation d’une structure pour initialiser les paramétres de l’horloge 00009 Serial pc(USBTX, USBRX); // initialisation de l’affichage (UART) sur un terminal 00010 pc.baud(9600); // réglage de la vitesse de transmission 00011 pc.printf("DS1338 Demo\r\n"); 00012 DS1338 ds1338(PB_7,PB_6); // l’initialisation des ports SDA et SCL 00013 //#ifdef INIT_TIME 00014 time.tm_sec=0; 00015 time.tm_min=46; 00016 time.tm_hour=13; 00017 time.tm_mday=12; 00018 time.tm_mon=9; 00019 time.tm_year=116; 00020 time.tm_wday=3; 00021 time.tm_yday=0; 00022 time.tm_isdst=0; 00023 00024 ds1338.writeTime(&time); // initialiser les paramétres de l’horloge 00025 //#endif 00026 while (true) { 00027 00028 00029 wait(0.5); 00030 ds1338.readTime(&time); //lecture de l’horloge 00031 pc.printf("time at %s\r\n",asctime(&time)); // affichage de l’heure sur terminal 00032 } 00033 }
Generated on Thu Jul 14 2022 12:53:53 by
1.7.2