Harish Mekali
/
7_Interrupt
Interrupt demo
Revision 0:ae29063c6988, committed 2014-04-05
- Comitter:
- HarishMekali
- Date:
- Sat Apr 05 07:07:09 2014 +0000
- Commit message:
- Interrupt
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
diff -r 000000000000 -r ae29063c6988 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sat Apr 05 07:07:09 2014 +0000 @@ -0,0 +1,23 @@ +#include "mbed.h" + +InterruptIn button1(p18); // Interrupt Input Object + +DigitalOut myLED1(LED1); +DigitalOut myLED2(LED2); + +void LED2_blink() // Interrupt Service Routine +{ + myLED2 = !myLED2; + wait(0.2); +} + +int main() +{ + button1.rise(&LED3_blink); // Be Interrupt‐aware; Service it when Spike is seen + while (1) // infinite loop + { + myLED1 = !myLED1; + wait(0.2); + } + +} \ No newline at end of file
diff -r 000000000000 -r ae29063c6988 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sat Apr 05 07:07:09 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/7d30d6019079 \ No newline at end of file