comunicacion serial

Dependencies:   SoftSerial mbed

Revision:
0:6f4089757c91
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Sep 28 00:34:10 2017 +0000
@@ -0,0 +1,29 @@
+#include "mbed.h" 
+#include "SoftSerial.h"
+
+SoftSerial MB(D2,D3);
+Serial PC(USBTX,USBRX);
+char rec; 
+char send;
+int main()
+{
+            
+    while(1) 
+    {
+         if(PC.readable()>0)
+         {
+        
+            send=PC.getc();
+            MB.printf("%c",send);
+            PC.printf("%c",send) ;
+            wait(0.2);
+        }
+        if(MB.readable()> 0)
+        {
+           rec=MB.getc();
+           PC.printf("%c",rec);
+           wait(0.2);
+    }
+        
+    }
+}