Harish Mekali
/
7_Interrupt
Interrupt demo
Diff: main.cpp
- Revision:
- 0:ae29063c6988
--- /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