Timeout ripetitivi

Dependencies:   mbed

Revision:
0:6550097e4ad1
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sun Nov 06 12:42:16 2016 +0000
@@ -0,0 +1,30 @@
+ #include "mbed.h"
+ Timeout to1;
+ DigitalOut myled(D3);
+ DigitalIn BlueButton(USER_BUTTON);
+ #define DLYFlash 0.2
+ bool ONOFF_Flashing = false;
+ void IntFlash(void);
+
+ int main()
+ {
+     to1.attach(&IntFlash, DLYFlash);
+     while(1) {
+         if (BlueButton == 0)
+         ONOFF_Flashing = true;
+         else
+         ONOFF_Flashing = false;
+     }
+ }
+
+ void IntFlash(void)
+ {
+     if (ONOFF_Flashing == true) {
+     myled = !myled;
+ } 
+ else {
+    myled = 0;
+ }
+ to1.detach();
+ to1.attach(&IntFlash, DLYFlash); // this line reload Interrupt
+ }
\ No newline at end of file