echo characters typed on USB debug port

Dependencies:   mbed

main.cpp

Committer:
mfiore
Date:
2015-12-02
Revision:
0:279c532226c8
Child:
1:43abfdd0709b

File content as of revision 0:279c532226c8:

// this program echos on the USB debug port

#include "mbed.h"

int main() {
    Serial usb(USBTX, USBRX);
    
    // change the following value to change the baud rate
    usb.baud(115200);
    
    while (true)
        if (usb.readable())
            usb.putc(usb.getc());
}