by Rob Toulson and Tim Wilmshurst from textbook "Fast and Effective Embedded Systems Design: Applying the ARM mbed"

Dependencies:   mbed

main.cpp

Committer:
robt
Date:
2013-05-24
Revision:
0:f604cd45b955

File content as of revision 0:f604cd45b955:

/* Program Example 9.11: Toggles LED1 every time p18 goes high. Uses hardware build shown in Figure 9.3.
                                                                         */
#include "mbed.h"
InterruptIn button(p5);     // Interrupt on digital pushbutton input p18 
DigitalOut led1(LED1);       // mbed LED1
void toggle(void);           // function prototype

int main() {
  button.rise(&toggle);                   // attach the address of the toggle
}                                         // function to the rising edge 

void toggle() {
  led1=!led1;
}