*** Fonctionne *** sur appui bouton: allumage led plus envoi message FFFF extinction led plus envoi message 0000

Dependencies:   DebouncedInterrupt mbed

Files at this revision

API Documentation at this revision

Comitter:
regimbal
Date:
Thu Apr 17 13:52:41 2014 +0000
Child:
1:03feb0de7f83
Commit message:
Fonctionne avec Sigfox en s?rie; 1 appui : led s'allume et message 1111 envoy?; 2 appuis : led s'eteint et message 0000 envoy?

Changed in this revision

DebouncedInterrupt.lib Show annotated file Show diff for this revision Revisions of this file
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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DebouncedInterrupt.lib	Thu Apr 17 13:52:41 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/kandangath/code/DebouncedInterrupt/#9733f886810a
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Apr 17 13:52:41 2014 +0000
@@ -0,0 +1,38 @@
+#include "mbed.h"
+#include "DebouncedInterrupt.h"
+
+DebouncedInterrupt mybutton(USER_BUTTON);
+DigitalOut myled(LED1);
+Serial sigfox(SERIAL_TX, SERIAL_RX);
+ 
+float delay = 1.0; // 1 sec
+bool etat = false;
+
+void onUp()
+{
+    //if (delay == 1.0)
+    //    delay = 0.2; // 200 ms
+    //else
+    //    delay = 1.0; // 1 sec
+        
+    etat = !etat;
+    if (etat == true) {
+        myled = 1;
+        sigfox.printf("AT$ss=1111\r\n");
+        }
+    else {
+        myled = 0;
+        sigfox.printf("AT$ss=0000\r\n");
+        }
+}
+ 
+int main()
+{
+    wait(2);
+    // sigfox.printf("AT$ss=0000\r\n");
+    mybutton.attach(&onUp, IRQ_FALL, 100);
+    while (1) {
+    //    myled = !myled;
+    //    wait(delay);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu Apr 17 13:52:41 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/6473597d706e
\ No newline at end of file