Mark Gottscho / Mbed 2 deprecated SerialEcho

Dependencies:   mbed

Committer:
mgottscho
Date:
Sun Mar 16 01:12:36 2014 +0000
Revision:
0:0aafe2ecef17
Added a comment.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mgottscho 0:0aafe2ecef17 1 /* main.cpp
mgottscho 0:0aafe2ecef17 2 * Tested with mbed board: FRDM-KL46Z
mgottscho 0:0aafe2ecef17 3 * Author: Mark Gottscho
mgottscho 0:0aafe2ecef17 4 * mgottscho@ucla.edu
mgottscho 0:0aafe2ecef17 5 */
mgottscho 0:0aafe2ecef17 6
mgottscho 0:0aafe2ecef17 7 #include "mbed.h"
mgottscho 0:0aafe2ecef17 8
mgottscho 0:0aafe2ecef17 9 /**
mgottscho 0:0aafe2ecef17 10 * Echo incoming serial data back out again.
mgottscho 0:0aafe2ecef17 11 */
mgottscho 0:0aafe2ecef17 12 int main() {
mgottscho 0:0aafe2ecef17 13 Serial console(PTE16, PTE17);
mgottscho 0:0aafe2ecef17 14 console.baud(115200);
mgottscho 0:0aafe2ecef17 15
mgottscho 0:0aafe2ecef17 16 char c;
mgottscho 0:0aafe2ecef17 17
mgottscho 0:0aafe2ecef17 18 while (1) {
mgottscho 0:0aafe2ecef17 19 if (console.readable()) { //Wait for incoming message from host (via serial bridge)
mgottscho 0:0aafe2ecef17 20 c = console.getc();
mgottscho 0:0aafe2ecef17 21 console.putc('>');
mgottscho 0:0aafe2ecef17 22 console.putc(' ');
mgottscho 0:0aafe2ecef17 23 console.putc(c);
mgottscho 0:0aafe2ecef17 24 console.putc('\r');
mgottscho 0:0aafe2ecef17 25 console.putc('\n');
mgottscho 0:0aafe2ecef17 26 }
mgottscho 0:0aafe2ecef17 27 }
mgottscho 0:0aafe2ecef17 28 }