ticker flag

Files at this revision

API Documentation at this revision

Comitter:
gr91
Date:
Mon Nov 09 16:54:22 2020 +0000
Parent:
3:8a79f8ce8378
Commit message:
ticker flag

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 8a79f8ce8378 -r f331cf018c19 main.cpp
--- a/main.cpp	Mon Nov 09 16:10:15 2020 +0000
+++ b/main.cpp	Mon Nov 09 16:54:22 2020 +0000
@@ -1,19 +1,22 @@
 #include "mbed.h"
-// interruption periodique directe
+// interruption periodique flag
 DigitalOut ledr(PB_4);//LED_red
 Ticker t1;
+unsigned int flag=0;
 void clignote_led(void);
 int main()
 {
-    unsigned char DOWN_P=0;
     ledr=1; // led r eteinte
-    t1.attach(&clignote_led, 1.00);
+    t1.attach(&clignote_led, 0.1);
     while(1) {
+        if(flag==1) {
+            flag=0;
+            ledr=!ledr;
+        }
     }
 }
 void clignote_led(void)
 {
-    ledr=!ledr;
+    flag=1;
 }
 
-