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
Revision 0:9330a73f2ea2, committed 2017-05-14
- Comitter:
- javierjsp
- Date:
- Sun May 14 19:19:34 2017 +0000
- Commit message:
- v1
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
diff -r 000000000000 -r 9330a73f2ea2 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sun May 14 19:19:34 2017 +0000 @@ -0,0 +1,18 @@ +#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 + } + } +}
diff -r 000000000000 -r 9330a73f2ea2 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sun May 14 19:19:34 2017 +0000 @@ -0,0 +1,1 @@ +https://mbed.org/users/mbed_official/code/mbed/builds/4eea097334d6 \ No newline at end of file