Allume la LED lorsque l'on tape "u" dans la console de l'ordinateur, et l'éteint lorsque l'on tape "d"
Dependencies: mbed
Revision 0:d97d9a984155, committed 2014-05-15
- Comitter:
- valdub
- Date:
- Thu May 15 08:29:53 2014 +0000
- Commit message:
- Program published
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 d97d9a984155 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu May 15 08:29:53 2014 +0000 @@ -0,0 +1,29 @@ +#include "mbed.h" + +Serial pc(USBTX,USBRX); +DigitalOut led(LED1); + +int main() +{ + pc.printf("press 'u' to turn on the led, and 'd' to turn off\n\r"); + led = 0; + + while(1) + { + char c = pc.getc(); + pc.putc(c); + if (pc.getc() == 13) + { + if ((c == 'u') && (led == 0)) + { + led = 1; + pc.printf("\n\r>> led allumee \n\r"); + } + if ((c == 'd') && (led ==1)) + { + led = 0; + pc.printf("\n\r>> led eteinte \n\r"); + } + } + } +}
diff -r 000000000000 -r d97d9a984155 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu May 15 08:29:53 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/6473597d706e \ No newline at end of file