External Interrupt example for WIZwiki-W7500 Academy

Dependencies:   mbed

Fork of GPIOIn_INT_HelloWorld_WIZwiki-W7500 by Lawrence Lee

Committer:
IOP
Date:
Fri Jul 24 02:00:34 2015 +0000
Revision:
7:2b3f33a45f27
Parent:
6:41c9ebdce05b
Child:
8:d8c1d43afdf0
run with easy module shield

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 7:2b3f33a45f27 5 InterruptIn mysw(D2); // SW1 on easy module shield
IOP 7:2b3f33a45f27 6 DigitalOut myled_R(D9); // LED_RED on easy module shield
IOP 7:2b3f33a45f27 7 DigitalOut myled_G(D10); // LED_GREEN on easy module shield
IOP 7:2b3f33a45f27 8 DigitalOut myled_B(D11); // LED_BLUE on easy module shield
joon874 0:4052805e9292 9
IOP 6:41c9ebdce05b 10 void exin(){ // interrupt function
IOP 6:41c9ebdce05b 11 myled_B = !myled_B; // Blue LED Toggle with rising edge
joon874 0:4052805e9292 12 }
joon874 0:4052805e9292 13
joon874 0:4052805e9292 14 int main() {
joon874 0:4052805e9292 15
IOP 7:2b3f33a45f27 16 myled_G = 0; // turn off the Green LED on shield
IOP 7:2b3f33a45f27 17
IOP 6:41c9ebdce05b 18 mysw.rise(&exin); // attach the address of the exin function to the rising edge
IOP 6:41c9ebdce05b 19 while(1) {
IOP 6:41c9ebdce05b 20 myled_R = !myled_R; // Red LED switching
joon874 4:296a62c9cb15 21 wait(1.0);
joon874 4:296a62c9cb15 22 }
joon874 4:296a62c9cb15 23
joon874 4:296a62c9cb15 24 }