echo characters typed on USB debug port

Dependencies:   mbed

main.cpp

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

File content as of revision 1:43abfdd0709b:

// this program echos on the USB debug port
// it also blinks the RSSI LED on the micro UDK and the D3 LED on the UDK2

#include "mbed.h"

DigitalOut uled(XBEE_RSSI);     // RSSI LED on micro UDK
DigitalOut led(LED1);           // D3 LED on UDK2

Ticker tick;
void tock(void) {
    uled = !uled;
    led = !led;
}

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