This will echo what you type directly to the LCD and serial.

Dependencies:   TextLCD mbed

Revision:
0:43501f452595
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sat Sep 07 17:25:17 2013 +0000
@@ -0,0 +1,31 @@
+#include "TextLCD.h"
+#include "mbed.h"
+TextLCD lcd(p21, p22, p23, p24, p25, p26); // rs, e, d4-d7
+Serial pc(USBTX, USBRX);
+
+int main()
+{
+    char c;
+    int i=0;
+    pc.printf("\x1B[2J");
+    pc.printf("\x1B[H");
+    pc.printf("Echoes back to the screen and LCD anything you type\n\r");
+    while(1) {
+
+        c=(pc.putc(pc.getc()));
+        lcd.printf("%c",c);
+        i++;
+
+
+
+        if (i==32) {
+            wait(0.1);
+            lcd.cls();//clear
+            pc.printf("\x1B[2J");
+            pc.printf("\x1B[H");
+            i=0;
+        }
+    }
+
+
+}
\ No newline at end of file