sebastian quitora / Mbed 2 deprecated chatserial

Dependencies:   SoftSerial mbed

Revision:
0:803792acd19e
Child:
1:25542223771f
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sat Sep 23 21:37:22 2017 +0000
@@ -0,0 +1,42 @@
+#include "mbed.h"
+#include "SoftSerial.h"
+
+SoftSerial nucleo (D8,D9);
+Serial pc(SERIAL_TX, SERIAL_RX);
+char sent,rec;
+int i =0;
+int k =0;
+int main()
+{
+    char msm[25]= {};
+    char led[25]= {};
+    char com[3] = {'o','f','f'};
+
+    while(1) {
+
+        if (pc.readable()>0) {
+            sent=pc.getc();
+            if(sent == 13) {
+                for (int j = 0; j<i; j++) {
+                    nucleo.printf("%c",msm[j]);
+                    pc.printf("%c",msm[j]);
+               wait(0.01);}
+               nucleo.printf("\n\r");
+               pc.printf("\n\r");
+                i=0;
+            } else {
+                msm[i]=sent;
+                i++;
+            }
+        }
+        if(nucleo.readable()>0) {
+             rec=nucleo.getc();             
+             pc.printf("%c",rec);
+     wait(0.01);
+     led[k]=rec; 
+     k++;
+     
+         }
+     
+    }
+}