Test the push button on m3pi connected to p21. when button pressed led 3 will light , otherwise led 1 will light
Revision 0:40d062361f4e, committed 2013-04-06
- Comitter:
- jalle1714
- Date:
- Sat Apr 06 14:24:56 2013 +0000
- Commit message:
- Test the Push Button on m3pi that is connected to p21 and ground
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 40d062361f4e main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sat Apr 06 14:24:56 2013 +0000 @@ -0,0 +1,23 @@ +#include "mbed.h" + +DigitalIn button(p21); +DigitalOut led(LED3); +DigitalOut myled(LED1); + +int main() +{ + button.mode(PullUp); + while(1) + { + if (button) + { + myled = 1; + led=0; + } + else + { + myled = 0; + led=1; + } + } +} \ No newline at end of file
diff -r 000000000000 -r 40d062361f4e mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sat Apr 06 14:24:56 2013 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/5e5da4a5990b \ No newline at end of file