programme horloge temps réelle
Dependencies: BSP_DISCO_F746NG LCD_DISCO_F746NG mbed
Fork of DS1338 by
Revision 3:ec3f4251b6f3, committed 2016-11-23
- Comitter:
- Asoumy
- Date:
- Wed Nov 23 23:03:16 2016 +0000
- Parent:
- 2:f65e93dd619c
- Commit message:
- programme horloge temps r?elle
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r f65e93dd619c -r ec3f4251b6f3 main.cpp --- a/main.cpp Wed Oct 12 14:10:40 2016 +0000 +++ b/main.cpp Wed Nov 23 23:03:16 2016 +0000 @@ -8,16 +8,8 @@ DigitalOut led1(LED1); int main() { - AnalogIn Vpan(A0); - AnalogIn Ipan(A1); - AnalogIn Tpan(A2); - AnalogIn Irr(A3); - AnalogIn Vbat(A4); - AnalogIn Ibat(A5); struct tm time; - //int count; - Serial pc(USBTX, USBRX); pc.baud(9600); pc.printf("DS1338 Demo\r\n"); @@ -32,22 +24,20 @@ time.tm_year=116; time.tm_wday=3; time.tm_yday=0; - time.tm_isdst=0; + time.tm_isdst=0;*/ ds1338.writeTime(&time); //#endif - + while (true) { - wait(0.5); - ds1338.readTime(&time); - //ds1338.read(0,4,(char *)(&count)); - //count++; - //ds1338.write(0,4,(char *)(&count)); - pc.printf("time at %s\r\n",asctime(&time)); - } lcd.Clear(LCD_COLOR_RED); lcd.SetBackColor(LCD_COLOR_RED); lcd.SetTextColor(LCD_COLOR_WHITE); - lcd.DisplayStringAt(0, LINE(5), (uint8_t *)"temps"), LEFT_MODE); - sprintf((char*)date, "Touches: %s", asctime(&time)); + sprintf((char*)date, "TIME: %s", asctime(&time)); + lcd.DisplayStringAt(0, LINE(1), (uint8_t *)date, LEFT_MODE); + wait(0.5); + ds1338.readTime(&time); + pc.printf("time at %s\r\n",asctime(&time)); + } + } \ No newline at end of file