Javier Sanchez Peña
/
Prueva_microswitch_pullup
use a digital input in pull up mode to read a signal from a microswitch and toggle a LED
main.cpp
- Committer:
- javierjsp
- Date:
- 2017-05-14
- Revision:
- 0:9330a73f2ea2
File content as of revision 0:9330a73f2ea2:
#include "mbed.h" DigitalIn micro(D0, PullUp); DigitalOut myled(LED1); int main() { while(1) { if (micro) { myled = 0; // LED is ON } else { myled = 1; // LED is OFF } } }