TEST serial port
Dependencies: mbed
Revision 0:ff659d8bffe7, committed 2015-01-14
- Comitter:
- BrunoV
- Date:
- Wed Jan 14 18:02:31 2015 +0000
- Commit message:
- TEST SERIAL PORT (SUCCESS)
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 ff659d8bffe7 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed Jan 14 18:02:31 2015 +0000 @@ -0,0 +1,37 @@ +#include "mbed.h" + +//------------------------------------ +// Hyperterminal configuration +// 9600 bauds, 8-bit data, no parity +//------------------------------------ + +Serial pc(USBTX, USBRX); + +DigitalOut myled(LED1); +DigitalOut LedExterne(D7); + +int main() +{ + int i = 1; + pc.printf("Hello World !\n"); + pc.baud(9600); + pc.format(8, SerialBase::None, 1); + + while(1) { + wait(1); + pc.printf("This program runs since %d seconds.\n", i++); + pc.printf("\n"); + myled = !myled; + LedExterne =! LedExterne; + char c = pc.getc(); + if ( c=='a') + { + LedExterne =0; + } + if ( c=='b') + { + LedExterne = 1 ; + } + + } +}
diff -r 000000000000 -r ff659d8bffe7 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Wed Jan 14 18:02:31 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/4fc01daae5a5 \ No newline at end of file