mX mbed BaseBoard Ext. Int.

Dependencies:   mbed

Committer:
ashwin_athani
Date:
Wed Dec 08 06:23:52 2010 +0000
Revision:
0:09eedb45b600

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ashwin_athani 0:09eedb45b600 1 #include "mbed.h"
ashwin_athani 0:09eedb45b600 2
ashwin_athani 0:09eedb45b600 3 InterruptIn button(p11);
ashwin_athani 0:09eedb45b600 4 DigitalOut led(LED1);
ashwin_athani 0:09eedb45b600 5 DigitalOut flash(LED4);
ashwin_athani 0:09eedb45b600 6
ashwin_athani 0:09eedb45b600 7 void flip() {
ashwin_athani 0:09eedb45b600 8 led = !led;
ashwin_athani 0:09eedb45b600 9 }
ashwin_athani 0:09eedb45b600 10
ashwin_athani 0:09eedb45b600 11 int main() {
ashwin_athani 0:09eedb45b600 12 button.rise(&flip); // attach the address of the flip function to the rising edge
ashwin_athani 0:09eedb45b600 13 while(1) { // wait around, interrupts will interrupt this!
ashwin_athani 0:09eedb45b600 14 flash = !flash;
ashwin_athani 0:09eedb45b600 15 wait(0.25);
ashwin_athani 0:09eedb45b600 16 }
ashwin_athani 0:09eedb45b600 17 }