Besa Mavriqi
/
Mbed_Dig_IN2
Da wird ein Programm für die digitale Eingabe (z.B. drücken eines Tasters) gezeigt.
Diff: Mbed_Dig_IN2.cpp
- Revision:
- 0:0da78fe0a0de
diff -r 000000000000 -r 0da78fe0a0de Mbed_Dig_IN2.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Mbed_Dig_IN2.cpp Wed Jan 15 00:44:13 2020 +0000 @@ -0,0 +1,15 @@ +//#define BUTTON1 p14 // push joystick pin +//#define BUTTON1 A1 // Taster A1 bei online Simulator verwenden +// Flash an LED while a DigitalIn is true +#include "mbed.h" +DigitalIn enable(BUTTON1); +DigitalOut led(LED1); + +int main() { + while(1) { + if(enable) { + led = !led; + } + wait(0.25); + } +} \ No newline at end of file