Mark Gottscho / Mbed 2 deprecated SerialEcho

Dependencies:   mbed

main.cpp

Committer:
mgottscho
Date:
2014-03-16
Revision:
0:0aafe2ecef17

File content as of revision 0:0aafe2ecef17:

/* main.cpp
 * Tested with mbed board: FRDM-KL46Z
 * Author: Mark Gottscho
 * mgottscho@ucla.edu
 */
 
#include "mbed.h"

/**
 * Echo incoming serial data back out again.
 */
int main() {
    Serial console(PTE16, PTE17);
    console.baud(115200);
    
    char c;
    
    while (1) {
        if (console.readable()) { //Wait for incoming message from host (via serial bridge)
            c = console.getc();
            console.putc('>');
            console.putc(' ');
            console.putc(c);
            console.putc('\r');
            console.putc('\n');
        }   
    }
}