mbed Workshops
/
Workshop-1-Example-4
A digital input monitoring implementation with busy wait.
Diff: main.cpp
- Revision:
- 0:c27624b8b1e0
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Mon Sep 26 16:22:10 2016 +0000 @@ -0,0 +1,16 @@ +#include "mbed.h" +#include "rtos.h" + +DigitalIn button(SW1); // Change to match your board +DigitalOut led(LED1); + +#define button_press 0 + +int main() { + while(1) { + if(button_press == button){ + led = !led; + wait(1); + } + } +} \ No newline at end of file