Jan Boerman / Mbed 2 deprecated Minor_test_serial

Dependencies:   mbed

Fork of Minor_test_serial by First Last

Revision:
1:0f8ca2b9b866
Parent:
0:c8f15874531b
--- a/main.cpp	Wed Sep 02 14:50:46 2015 +0000
+++ b/main.cpp	Mon Sep 12 10:33:36 2016 +0000
@@ -1,19 +1,16 @@
 #include "mbed.h"
-#include "MODSERIAL.h"
 
 DigitalOut myled(LED_GREEN);
-MODSERIAL pc(USBTX, USBRX);
+Serial pc(USBTX, USBRX, "YOLO");
 
 int main()
 {
-    int i = 0;
     pc.baud(115200);
     pc.printf("Hello World!\n");
     
     while (true) {
-        wait(0.5f); // wait a small period of time
-        pc.printf("%d \n", i); // print the value of variable i
-        i++; // increment the variable
-        myled = !myled; // toggle a led
+        char c = pc.getc();     //get a character from the computer keyboard
+        pc.printf("%c\r\n",c);  //print the pressed character
+        myled = !myled;         // toggle the green LED
     }
 }