External Interrupt example for WIZwiki-W7500 Academy

Dependencies:   mbed

Fork of GPIOIn_INT_HelloWorld_WIZwiki-W7500 by Lawrence Lee

Committer:
IOP
Date:
Wed Feb 03 07:21:45 2016 +0000
Revision:
10:e47e799ccc98
Parent:
9:7c19b19301c5
update mbed lib

Who changed what in which revision?

UserRevisionLine numberNew contents of line
joon874 3:f3fffb66c845 1 /* GPIO Input Interrupt Example Program */
joon874 4:296a62c9cb15 2
joon874 0:4052805e9292 3 #include "mbed.h"
IOP 7:2b3f33a45f27 4
IOP 8:d8c1d43afdf0 5 DigitalOut myled_R(LED_RED); // LED_RED on WIZwiki-W7500
IOP 8:d8c1d43afdf0 6 DigitalOut myled_B(LED_BLUE); // LED_BLUE on WIZwiki-W7500
IOP 8:d8c1d43afdf0 7
IOP 10:e47e799ccc98 8 InterruptIn mysw(D10); // push switch
IOP 10:e47e799ccc98 9
joon874 0:4052805e9292 10
IOP 10:e47e799ccc98 11 void exin(); // interrupt function
joon874 0:4052805e9292 12
joon874 0:4052805e9292 13 int main() {
joon874 0:4052805e9292 14
IOP 10:e47e799ccc98 15 mysw.rise(&exin); // attach the address of the exin function to the rising edge
IOP 7:2b3f33a45f27 16
IOP 10:e47e799ccc98 17 while(1){
IOP 10:e47e799ccc98 18 myled_R = !myled_R; // Red LED switching continuosly
IOP 8:d8c1d43afdf0 19 wait(0.5);
IOP 8:d8c1d43afdf0 20 }
IOP 10:e47e799ccc98 21 }
IOP 10:e47e799ccc98 22
IOP 10:e47e799ccc98 23 void exin(){
IOP 10:e47e799ccc98 24 myled_B = !myled_B; // Blue LED Toggle with rising edge
joon874 4:296a62c9cb15 25 }