Added carriage return to the printf string and removed "pc." from another snippet of code to see if that would work.
Fork of Serial_HelloWorld_Mbed by
main.cpp@1:8a1ffe1119db, 2015-12-17 (annotated)
- Committer:
- captaintim
- Date:
- Thu Dec 17 22:01:30 2015 +0000
- Revision:
- 1:8a1ffe1119db
- Parent:
- 0:879aa9d0247b
Added carriage return to printf string and didn't need the "pc." either for print f.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mbed_official | 0:879aa9d0247b | 1 | #include "mbed.h" |
mbed_official | 0:879aa9d0247b | 2 | |
captaintim | 1:8a1ffe1119db | 3 | //using TeraTerm, this worked out of the box |
captaintim | 1:8a1ffe1119db | 4 | |
captaintim | 1:8a1ffe1119db | 5 | //added carriage return and in worked in the sequence \r (carriage return) followed by \n (new line) all within the String |
captaintim | 1:8a1ffe1119db | 6 | |
captaintim | 1:8a1ffe1119db | 7 | //Serial pc(USBTX, USBRX); // tx, rx |
captaintim | 1:8a1ffe1119db | 8 | |
captaintim | 1:8a1ffe1119db | 9 | //comment out line 11, 17-20 and printf works fine--alternately if you eliminate "pc." on the second printf, it too will work. |
captaintim | 1:8a1ffe1119db | 10 | |
captaintim | 1:8a1ffe1119db | 11 | Serial pc(USBTX, USBRX); |
captaintim | 1:8a1ffe1119db | 12 | |
mbed_official | 0:879aa9d0247b | 13 | |
mbed_official | 0:879aa9d0247b | 14 | int main() { |
captaintim | 1:8a1ffe1119db | 15 | printf("Hello World!\r\n"); |
captaintim | 1:8a1ffe1119db | 16 | |
captaintim | 1:8a1ffe1119db | 17 | pc.printf("Echoes back to the screen anything you type\r\n"); |
mbed_official | 0:879aa9d0247b | 18 | while(1) { |
captaintim | 1:8a1ffe1119db | 19 | pc.putc(pc.getc()); |
mbed_official | 0:879aa9d0247b | 20 | } |
mbed_official | 0:879aa9d0247b | 21 | } |