Dependencies:   mbed

main.cpp

Committer:
gcarmonar
Date:
2014-05-09
Revision:
0:d10d1e4ecd6b

File content as of revision 0:d10d1e4ecd6b:

/*
  On KL25Z interrupts only works on ports A and D
  Options are: raise and fall
*/

#include "mbed.h"
 
InterruptIn button(PTD4); //D3
DigitalOut led(LED1);
DigitalOut flash(LED3);
 

void flip();
 
int main() {
    button.rise(&flip);  // attach the address of the flip function to the rising edge
    
    while(1) {           // wait around, interrupts will interrupt this!
        flash = !flash;
        wait(0.25);
    }
}

void flip() {
    led = !led;
}