led toggle en dingen printen naar pc

Dependencies:   mbed Minor_test_serial MODSERIAL

Revision:
2:2aa3c9a2a838
Parent:
1:40470bc517f1
--- a/main.cpp	Mon Sep 11 10:42:39 2017 +0000
+++ b/main.cpp	Wed Sep 26 12:09:29 2018 +0000
@@ -4,16 +4,23 @@
 DigitalOut myled(LED_GREEN);
 MODSERIAL pc(USBTX, USBRX);
 
+
 int main()
 {
-    int i = 0;
     pc.baud(115200);
-    pc.printf("Hello World!\r\n");
-    
+    myled = 1;
+    pc.printf("\r\nBoard reset, start again\r\n");
+        
     while (true) {
-        wait(0.5f); // wait a small period of time
-        pc.printf("%d \r\n", i); // print the value of variable i
-        i++; // increment the variable
-        myled = !myled; // toggle a led
+        wait(0.05f); // wait a small period of time
+        char c;
+        c = pc.getc();
+        if(pc.getc()){
+            myled = !myled; // toggle a led
+            pc.printf("\r%c\r\n",c);
+            }
+        else{
+        }
+                
     }
 }