Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Revision 0:fe8a2e63737f, committed 2017-12-15
- Comitter:
- ygendrault
- Date:
- Fri Dec 15 15:04:47 2017 +0000
- Commit message:
- On/Off on the embedded LED on Nucleo for ECAM S-E student
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 fe8a2e63737f main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri Dec 15 15:04:47 2017 +0000 @@ -0,0 +1,46 @@ +#include "mbed.h" + +Serial pc(SERIAL_TX, SERIAL_RX); +DigitalOut led(LED1); +int test = 0; +char previous = 0; + +int main() +{ + pc.printf("Press '1' to turn LED1 ON, '0' to turn it OFF\n"); + while(1) { + char c = pc.getc(); // Read hyperterminal + if (c == '0') { + if (previous=='1') + { + test =0; + } + if (test==0) + { + test=1; + previous = '0'; + led = 0; // OFF + } + else + { + pc.printf("LED already OFF\n"); + } + } + if (c == '1') { + if (previous=='0') + { + test =0; + } + if (test==0) + { + test=1; + previous = '1'; + led = 1; // OFF + } + else + { + pc.printf("LED already ON\n"); + } + } + } +}
diff -r 000000000000 -r fe8a2e63737f mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Fri Dec 15 15:04:47 2017 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/e7ca05fa8600 \ No newline at end of file