pouet

Dependencies:   mbed

Revision:
0:2db056248979
diff -r 000000000000 -r 2db056248979 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Feb 06 14:01:12 2017 +0000
@@ -0,0 +1,49 @@
+#include "mbed.h"
+#include "C12832.h"
+
+DigitalOut LED(D13);
+DigitalIn BP(PC_13,PullNone);
+AnalogIn pot1(PA_0);
+Serial pc(SERIAL_TX, SERIAL_RX);
+Ticker t;
+Timer timer;
+int hour=23, min=59, sec=53;
+bool affichage=true;
+
+void isr_horloge(void)
+{
+    if(sec<60)
+    {
+        sec=sec+1;
+    }
+    if(sec>59)
+    {
+        sec=0;
+        min=min+1;
+        if(min>59)
+        {
+            min=0;
+            hour=hour+1;
+            if(hour>23)
+            {
+                hour=0;
+            }
+        }
+    }
+    affichage=true;
+}
+
+int main()
+{
+    pc.baud(4800);
+    t.attach(&isr_horloge,1);
+    
+    while(1)
+    {
+      if(affichage)
+      {
+        pc.printf("%d:%d:%d\n",hour,min,sec);
+        affichage=false;     
+      }
+    }
+}
\ No newline at end of file