Timeout ripetitivi

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
Mattinico
Date:
Sun Nov 06 12:42:16 2016 +0000
Commit message:
k

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 6550097e4ad1 main.cpp
--- /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
diff -r 000000000000 -r 6550097e4ad1 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Sun Nov 06 12:42:16 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/9bcdf88f62b0
\ No newline at end of file