Demonstrate dependency between serial input and output

Revision:
0:2af96b59072d
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Aug 22 13:13:18 2016 +0000
@@ -0,0 +1,21 @@
+#include "mbed.h"
+Serial pc(USBTX, USBRX);
+
+void
+logchars(void) {
+    while (true) {
+        int c = pc.getc();
+        pc.printf("[%02x]\r\n", c);
+    }
+}
+
+int main(void) {
+    Thread logger;
+    pc.printf("putc/getc test\r\n");
+    logger.start(logchars);
+    while (true) {
+        pc.printf("tick\r\n");
+        wait(1.0);
+    }
+    return 0;
+}
\ No newline at end of file