sample of getting console key

Dependencies:   mbed

Sample code of how to get key hit.
readable() function in Serial class can check buffer has data or not.

This could be equivalent to kbhit() function of DOS/Win environment.

Revision:
0:06c67ac20cd3
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sat Apr 09 08:08:16 2016 +0000
@@ -0,0 +1,13 @@
+#include "mbed.h"
+
+Serial  pc( USBTX, USBRX );
+BusOut  leds( LED4, LED3, LED2, LED1 );
+
+int main()
+{
+    while (1) {
+        if ( pc.readable() ) {
+            leds    = pc.getc() - '0';
+        }
+    }
+}