Allume/eteint une lampe en appuyant sur le bouton, et envoie un message sigfox à l'ordinateur affichant "allume" ou "eteint".
Dependencies: DebouncedInterrupt mbed
Fork of led_sigfox by
Revision 3:1b1f437a91ac, committed 2014-05-15
- Comitter:
- valdub
- Date:
- Thu May 15 08:18:28 2014 +0000
- Parent:
- 2:2f56bf215c89
- Commit message:
- Program published
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 2f56bf215c89 -r 1b1f437a91ac main.cpp --- a/main.cpp Mon Apr 21 22:46:48 2014 +0000 +++ b/main.cpp Thu May 15 08:18:28 2014 +0000 @@ -2,12 +2,12 @@ #include "DebouncedInterrupt.h" DebouncedInterrupt mybutton(USER_BUTTON); -DigitalOut myled(LED1); +DigitalOut pin_out(PA_10); +DigitalOut led(LED1); Serial sigfox(SERIAL_TX, SERIAL_RX); - -float delay = 1.0; // 1 sec + bool etat = false; -bool buttontriggered = false; +bool buttontriggered = true; void onUp() { @@ -18,19 +18,19 @@ { etat = !etat; if (etat == true) { - myled = 1; - sigfox.printf("AT$ss=FFFF\r\n"); // code pour recevoir "allume" sur le POC Radhius + led = 0; + pin_out = 1; + sigfox.printf("AT$ss=0000\r\n"); // code pour recevoir "eteint" sur le POC Radhius } else { - myled = 0; - sigfox.printf("AT$ss=0000\r\n"); // code pour recevoir "eteint" sur le POC Radhius + led = 1; + pin_out = 0; + sigfox.printf("AT$ss=FFFF\r\n"); // code pour recevoir "allume" sur le POC Radhius } } int main() { - wait(2); - // sigfox.printf("AT$ss=0000\r\n"); mybutton.attach(&onUp, IRQ_FALL, 100); while (1) { if (buttontriggered == true) {