Estan Lujan
/
baud_test
test code
Fork of FRDM_serial_pc_board_pass_through by
Diff: main.cpp
- Revision:
- 0:bab6dd4a9c11
- Child:
- 1:4d30bb984196
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sat Oct 05 19:46:21 2013 +0000 @@ -0,0 +1,23 @@ +#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; + } + } +} \ No newline at end of file