Simon Ford
/
Serial2Serial
Simple example of a serial port communicating with another serial port
Diff: main.cpp
- Revision:
- 0:3c9dd1f868aa
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sun Feb 13 20:43:09 2011 +0000 @@ -0,0 +1,19 @@ +// example showing sending/receiving character + +#include "mbed.h" + +// connect p9 to p14 with a wire! +Serial out(p9, NC); +Serial in(NC, p14); + +DigitalOut led(LED1); + +int main() { + out.putc('h'); + out.putc('i'); + char c1 = in.getc(); + char c2 = in.getc(); + + led = 1; + printf("c1: %c, c2: %c\n", c1, c2); +}