interrupt
Dependencies: mbed
main.cpp
- Committer:
- florianjehannin
- Date:
- 2017-01-18
- Revision:
- 0:a3c8e021fd64
File content as of revision 0:a3c8e021fd64:
#include "mbed.h" InterruptIn button(PB_13); DigitalOut led(LED2); void flip() { led = !led; wait(0.1); } int main() { button.mode(PullUp); wait(0.01); button.fall(&flip); // attach the address of the flip function to the rising edge led = 0; while(1) { // wait around, interrupts will interrupt this! } }