FRDM-K64 Interrupt basic demo

Dependencies:   mbed

Committer:
APanecatl
Date:
Wed Jul 09 19:31:07 2014 +0000
Revision:
0:5d8424654e0e
rev 1.0

Who changed what in which revision?

UserRevisionLine numberNew contents of line
APanecatl 0:5d8424654e0e 1 #include "mbed.h"
APanecatl 0:5d8424654e0e 2
APanecatl 0:5d8424654e0e 3
APanecatl 0:5d8424654e0e 4 DigitalOut Red(LED1);
APanecatl 0:5d8424654e0e 5 DigitalOut Blue(LED3);
APanecatl 0:5d8424654e0e 6 InterruptIn Interrupt(SW2);
APanecatl 0:5d8424654e0e 7
APanecatl 0:5d8424654e0e 8
APanecatl 0:5d8424654e0e 9 void blink()
APanecatl 0:5d8424654e0e 10 {
APanecatl 0:5d8424654e0e 11 wait(.4);
APanecatl 0:5d8424654e0e 12 Red=1;
APanecatl 0:5d8424654e0e 13 Blue=0;
APanecatl 0:5d8424654e0e 14 wait(.4);
APanecatl 0:5d8424654e0e 15 Blue=1;
APanecatl 0:5d8424654e0e 16 wait(.4);
APanecatl 0:5d8424654e0e 17 }
APanecatl 0:5d8424654e0e 18
APanecatl 0:5d8424654e0e 19 int main()
APanecatl 0:5d8424654e0e 20 {
APanecatl 0:5d8424654e0e 21 Interrupt.fall(&blink);
APanecatl 0:5d8424654e0e 22 Blue=1;
APanecatl 0:5d8424654e0e 23 while (1)
APanecatl 0:5d8424654e0e 24 {
APanecatl 0:5d8424654e0e 25 Red=!Red;
APanecatl 0:5d8424654e0e 26 wait(.4);
APanecatl 0:5d8424654e0e 27 }
APanecatl 0:5d8424654e0e 28 }