example serial

Dependencies:   mbed

Fork of mDot_Serial_Example by MultiTech

Files at this revision

API Documentation at this revision

Comitter:
naushadRahman
Date:
Tue Jan 24 10:54:54 2017 +0000
Parent:
1:d2ee7143632f
Commit message:
first commint

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Fri Oct 02 15:23:02 2015 +0000
+++ b/main.cpp	Tue Jan 24 10:54:54 2017 +0000
@@ -11,11 +11,36 @@
  */
  
 #include "mbed.h"
+#include <string>
+
+
  
+ //Serial pc(USBTX, USBRX);
+ 
+ //Serial pc(PA_2, PA_3);
+ 
+ Serial pc(USBTX, USBRX);
+
+Serial device(PA_2, PA_3);  // tx, rx
+
 int main() {
-    Serial pc(USBTX, USBRX);
-    
-    while (true)
-        if (pc.readable())
-            pc.putc(pc.getc());
-}
\ No newline at end of file
+    device.baud(9600);
+    while(1) {
+        /*(pc.readable()) {
+            device.putc(pc.getc());
+            
+        }*/
+        
+       
+        
+        //delay(500);
+        if(device.readable()) {
+             pc.putc('h');
+             pc.putc('\r');
+           // pc.putc(device.getc());
+        }
+    }
+}
+ 
+ 
+