fgj

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
mexinguer
Date:
Mon Feb 06 13:19:02 2017 +0000
Commit message:
gsfd

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r 50094f63b4b9 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Feb 06 13:19:02 2017 +0000
@@ -0,0 +1,61 @@
+#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 cpt=48, inactif;
+bool appui = false;
+
+void isr_LED(void)
+{
+        if(cpt>57)
+        {
+            cpt=48;
+            pc.putc(012);
+        }
+        if(appui)
+        {
+            pc.putc(cpt);
+            LED=!LED; 
+            cpt++;
+        }       
+}
+
+int main()
+{
+    pc.baud(38400);
+    t.attach(&isr_LED,0.25);   
+
+    while(1) 
+    {
+     if(BP==0 && !appui)
+     {
+        appui=true;
+        timer.reset();
+        while(BP==0);
+        timer.start();       
+     }
+      inactif = timer.read_ms();
+      
+        if(BP==0 && appui || inactif>10000)
+     {
+        appui=false;
+        if(inactif>10000)
+        {
+            Timeout timer;
+            t.attach(isr_LED,1);
+        }
+        timer.stop();
+        inactif=0;
+        cpt=48;
+        while(BP==0);       
+        pc.putc(012);
+        
+     }    
+    }
+}
\ No newline at end of file
diff -r 000000000000 -r 50094f63b4b9 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon Feb 06 13:19:02 2017 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/ad3be0349dc5
\ No newline at end of file