Interrupt code example for FRDM-KL25Z

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 
00003 
00004 DigitalOut RED(LED1);
00005 DigitalOut BLUE(LED2);
00006 InterruptIn Interrupt(PTD1);
00007 
00008 
00009 void blink()
00010 {
00011     RED=1;
00012     BLUE=0;
00013     wait(.4);
00014     BLUE=1;
00015     wait(.4);
00016 }
00017 
00018 int main() 
00019 {
00020     Interrupt.fall(&blink);
00021     
00022     BLUE=1;
00023     while (1) 
00024     {
00025         RED=0;
00026     }
00027        
00028 }