External Interrupt example for WIZwiki-W7500 Academy
Dependencies: mbed
Fork of GPIOIn_INT_HelloWorld_WIZwiki-W7500 by
main.cpp@6:41c9ebdce05b, 2015-07-24 (annotated)
- Committer:
- IOP
- Date:
- Fri Jul 24 00:23:01 2015 +0000
- Revision:
- 6:41c9ebdce05b
- Parent:
- 4:296a62c9cb15
- Child:
- 7:2b3f33a45f27
led colors changed
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
joon874 | 3:f3fffb66c845 | 1 | /* GPIO Input Interrupt Example Program */ |
joon874 | 4:296a62c9cb15 | 2 | |
joon874 | 0:4052805e9292 | 3 | #include "mbed.h" |
joon874 | 0:4052805e9292 | 4 | |
joon874 | 4:296a62c9cb15 | 5 | InterruptIn mysw(D10); |
IOP | 6:41c9ebdce05b | 6 | DigitalOut myled_R(LED1); // Red LED |
IOP | 6:41c9ebdce05b | 7 | DigitalOut myled_B(LED3); // Blue LED |
joon874 | 0:4052805e9292 | 8 | |
IOP | 6:41c9ebdce05b | 9 | void exin(){ // interrupt function |
IOP | 6:41c9ebdce05b | 10 | myled_B = !myled_B; // Blue LED Toggle with rising edge |
joon874 | 0:4052805e9292 | 11 | } |
joon874 | 0:4052805e9292 | 12 | |
joon874 | 0:4052805e9292 | 13 | int main() { |
joon874 | 0:4052805e9292 | 14 | |
IOP | 6:41c9ebdce05b | 15 | mysw.rise(&exin); // attach the address of the exin function to the rising edge |
IOP | 6:41c9ebdce05b | 16 | while(1) { |
IOP | 6:41c9ebdce05b | 17 | myled_R = !myled_R; // Red LED switching |
joon874 | 4:296a62c9cb15 | 18 | wait(1.0); |
joon874 | 4:296a62c9cb15 | 19 | } |
joon874 | 4:296a62c9cb15 | 20 | |
joon874 | 4:296a62c9cb15 | 21 | } |