serial pc board pass through, use your board like a usb-serial 3.3V level converter,

Dependencies:   mbed

main.cpp

Committer:
felipeM
Date:
2013-10-05
Revision:
0:bab6dd4a9c11

File content as of revision 0:bab6dd4a9c11:

#include "mbed.h"
 
Serial pc(USBTX, USBRX);
//TX RX pins, see https://mbed.org/handbook/mbed-FRDM-KL25Z
Serial uart(PTC4, PTC3);
//to test is you can use a hard bridge (piece of cable) between PTC4 and PTC3 open a terminal and write something :) 
//you can integrate this to improve some interesting aplicattions like this:
//http://www.instructables.com/id/Temperature-sensor--weatherstation/http://www.instructables.com/id/Temperature-sensor--weatherstation/ 
DigitalOut pc_activity(LED1);
DigitalOut uart_activity(LED2);
 
int main() {
    while(1) {
        if(pc.readable()) {
            uart.putc(pc.getc());
            pc_activity = !pc_activity;
        }
        if(uart.readable()) {
            pc.putc(uart.getc());
            uart_activity = !uart_activity;
        }
    }
}