Example using LED and push button
Fork of mbed-os-example-mbed5-blinky by
main.cpp
- Committer:
- bigg55
- Date:
- 2017-10-12
- Revision:
- 42:ee570b89946e
- Parent:
- 29:0b58d21e87d6
File content as of revision 42:ee570b89946e:
#include "mbed.h"
InterruptIn enable(D0); //Button active LOW
DigitalOut led(D1);
DigitalOut flash(D2);
void flip() {
led = !led;
}
int main() {
enable.rise(&flip); // attach the address of the flip function to the rising edge
while(1) { // wait around, interrupts will interrupt this!
flash = !flash;
wait(5);
}
}
