my program
Dependencies: mbed
Fork of DigitalIn_HelloWorld_Mbed by
Revision 4:65c7b7e82f34, committed 2014-10-13
- Comitter:
- shiyilei
- Date:
- Mon Oct 13 03:26:12 2014 +0000
- Parent:
- 3:e2f865861a7a
- Commit message:
- This is a program to handle key message
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Sun Sep 21 19:20:53 2014 +0000 +++ b/main.cpp Mon Oct 13 03:26:12 2014 +0000 @@ -1,14 +1,25 @@ +/*********************************************** +*file name:model key +*creator: Jacob Shi +*time: 2014/10/13 +*description: the program imitates a model key + ***********************************************/ #include "mbed.h" - -DigitalIn enable(p5); -DigitalOut led(LED1); - -// blink LED when enable line is high -int main() { - while(1) { - if(enable) { - led = !led; +DigitalIn key(P0_9); +DigitalOut myled(LED1); +int main(int argc, char const *argv[]) +{ + myled=0; + while(1) + { + if(key) + { + wait_ms(10); + if(key) + myled=1; } - wait(0.25); + else + myled=0; } +return 0; } \ No newline at end of file