External Interrupt example for WIZwiki-W7500 Academy

Dependencies:   mbed

Fork of GPIOIn_INT_HelloWorld_WIZwiki-W7500 by Lawrence Lee

main.cpp

Committer:
IOP
Date:
2015-07-24
Revision:
6:41c9ebdce05b
Parent:
4:296a62c9cb15
Child:
7:2b3f33a45f27

File content as of revision 6:41c9ebdce05b:

/* GPIO Input Interrupt Example Program */
 
#include "mbed.h"
 
InterruptIn mysw(D10);
DigitalOut myled_R(LED1);    // Red LED
DigitalOut myled_B(LED3);    // Blue LED
 
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) {                
        myled_R = !myled_R;   // Red LED switching
        wait(1.0);
    }
    
}