External Interrupt example for WIZwiki-W7500 Academy
Dependencies: mbed
Fork of GPIOIn_INT_HelloWorld_WIZwiki-W7500 by
Diff: main.cpp
- Revision:
- 6:41c9ebdce05b
- Parent:
- 4:296a62c9cb15
- Child:
- 7:2b3f33a45f27
--- a/main.cpp Fri Jul 10 05:47:54 2015 +0000 +++ b/main.cpp Fri Jul 24 00:23:01 2015 +0000 @@ -3,18 +3,18 @@ #include "mbed.h" InterruptIn mysw(D10); -DigitalOut myled1(LED1); -DigitalOut myled2(LED2); +DigitalOut myled_R(LED1); // Red LED +DigitalOut myled_B(LED3); // Blue LED -void exin(){ - myled2 = !myled2; +void exin(){ // interrupt function + myled_B = !myled_B; // Blue LED Toggle with rising edge } int main() { - mysw.rise(&exin); // attach the address of the exin function to the rising edge - while(1) { // wait around, interrupts will interrupt this! - myled1 = !myled1; + mysw.rise(&exin); // attach the address of the exin function to the rising edge + while(1) { + myled_R = !myled_R; // Red LED switching wait(1.0); }