Example Interrupt code for FRDM platforms

Dependencies:   mbed

Fork of frdm_interrupt by Freescale

Committer:
Kojto
Date:
Thu Apr 03 08:49:54 2014 +0000
Revision:
0:4dcd605c8931
initial version

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Kojto 0:4dcd605c8931 1 #include "mbed.h"
Kojto 0:4dcd605c8931 2
Kojto 0:4dcd605c8931 3 DigitalOut led_red(LED_RED);
Kojto 0:4dcd605c8931 4 InterruptIn sw2(SW2);
Kojto 0:4dcd605c8931 5
Kojto 0:4dcd605c8931 6 void sw2_release(void)
Kojto 0:4dcd605c8931 7 {
Kojto 0:4dcd605c8931 8 led_red = !led_red;
Kojto 0:4dcd605c8931 9 printf("On-board button SW2 was released.\n");
Kojto 0:4dcd605c8931 10 }
Kojto 0:4dcd605c8931 11
Kojto 0:4dcd605c8931 12 int main()
Kojto 0:4dcd605c8931 13 {
Kojto 0:4dcd605c8931 14 sw2.rise(&sw2_release);
Kojto 0:4dcd605c8931 15 while (true) {
Kojto 0:4dcd605c8931 16 }
Kojto 0:4dcd605c8931 17 }