Tim Johnson / Mbed 2 deprecated Serial_HelloWorld_Mbed

Dependencies:   mbed

Fork of Serial_HelloWorld_Mbed by mbed official

Files at this revision

API Documentation at this revision

Comitter:
captaintim
Date:
Thu Dec 17 22:01:30 2015 +0000
Parent:
0:879aa9d0247b
Commit message:
Added carriage return to printf string and didn't need the "pc." either for print f.

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 879aa9d0247b -r 8a1ffe1119db main.cpp
--- a/main.cpp	Tue Feb 12 17:39:05 2013 +0000
+++ b/main.cpp	Thu Dec 17 22:01:30 2015 +0000
@@ -1,10 +1,21 @@
 #include "mbed.h"
  
-Serial pc(USBTX, USBRX); // tx, rx
+ //using TeraTerm, this worked out of the box
+ 
+ //added carriage return and in worked in the sequence \r (carriage return) followed by \n (new line) all within the String
+ 
+//Serial pc(USBTX, USBRX); // tx, rx
+
+//comment out line 11, 17-20 and printf works fine--alternately if you eliminate "pc." on the second printf, it too will work.  
+
+Serial pc(USBTX, USBRX);
+
  
 int main() {
-    pc.printf("Hello World!\n");
+    printf("Hello World!\r\n");
+    
+     pc.printf("Echoes back to the screen anything you type\r\n");
     while(1) {
-        pc.putc(pc.getc() + 1);
+        pc.putc(pc.getc());
     }
 }
\ No newline at end of file