External Interrupt example for WIZwiki-W7500 Academy
Dependencies: mbed
Fork of GPIOIn_INT_HelloWorld_WIZwiki-W7500 by
main.cpp@9:7c19b19301c5, 2016-01-06 (annotated)
- Committer:
- IOP
- Date:
- Wed Jan 06 06:36:42 2016 +0000
- Revision:
- 9:7c19b19301c5
- Parent:
- 8:d8c1d43afdf0
- Child:
- 10:e47e799ccc98
change pin number
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" |
IOP | 7:2b3f33a45f27 | 4 | |
IOP | 9:7c19b19301c5 | 5 | InterruptIn mysw(D10); // push switch |
IOP | 8:d8c1d43afdf0 | 6 | DigitalOut myled_R(LED_RED); // LED_RED on WIZwiki-W7500 |
IOP | 8:d8c1d43afdf0 | 7 | DigitalOut myled_B(LED_BLUE); // LED_BLUE on WIZwiki-W7500 |
IOP | 8:d8c1d43afdf0 | 8 | |
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 | 8:d8c1d43afdf0 | 16 | mysw.rise(&exin); // attach the address of the exin function to the rising edge |
IOP | 7:2b3f33a45f27 | 17 | |
IOP | 6:41c9ebdce05b | 18 | while(1) { |
IOP | 8:d8c1d43afdf0 | 19 | myled_R = !myled_R; // Red LED switching continuosly |
IOP | 8:d8c1d43afdf0 | 20 | wait(0.5); |
IOP | 8:d8c1d43afdf0 | 21 | } |
joon874 | 4:296a62c9cb15 | 22 | } |