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-08-04
Revision:
8:d8c1d43afdf0
Parent:
7:2b3f33a45f27
Child:
9:7c19b19301c5

File content as of revision 8:d8c1d43afdf0:

/* GPIO Input Interrupt Example Program */
 
#include "mbed.h"

InterruptIn mysw(D2);       // push switch
DigitalOut myled_R(LED_RED);     // LED_RED on WIZwiki-W7500
DigitalOut myled_B(LED_BLUE);    // LED_BLUE on WIZwiki-W7500

 
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 continuosly
        wait(0.5);      
    }   
}