Liam Hoffman / Mbed OS mDotInterruptExample

Fork of mbed-os-example-mbed5-blinky by mbed-os-examples

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002  
00003 InterruptIn enable(D0); //Button active LOW
00004 DigitalOut led(D1); 
00005 DigitalOut flash(D2);
00006 void flip() {
00007     led = !led;
00008 }
00009  
00010 int main() {
00011     enable.rise(&flip);  // attach the address of the flip function to the rising edge
00012     while(1) {           // wait around, interrupts will interrupt this!
00013         flash = !flash;
00014         wait(5);
00015     }
00016 
00017 }