TEST serial port
Dependencies: mbed
Diff: main.cpp
- Revision:
- 0:ff659d8bffe7
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 ; + } + + } +}