mbed school
/
mbed_button_for_LED
使用 button 控制 LED
Revision 0:b38f3a86b62b, committed 2015-02-14
- Comitter:
- mbedschool
- Date:
- Sat Feb 14 05:48:52 2015 +0000
- Commit message:
- update
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 |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sat Feb 14 05:48:52 2015 +0000 @@ -0,0 +1,19 @@ +#include "mbed.h" + +DigitalOut myled(LED1); +DigitalIn button(p21); + +int main() +{ + while(1){ + if(button){ + myled = 1 ; + + } + else + myled = 0; + + wait(0.7); // simple debouncing + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sat Feb 14 05:48:52 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/e188a91d3eaa \ No newline at end of file