test code

Dependencies:   mbed-rtos mbed

Fork of FRDM_serial_pc_board_pass_through by felipe manrique

main.cpp

Committer:
felipeM
Date:
2013-10-05
Revision:
0:bab6dd4a9c11
Child:
1:4d30bb984196

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;
        }
    }
}