Basic serial bi-directional program for MTSAS
Dependencies: SocketModem mbed
main.cpp
- Committer:
- falingtrea
- Date:
- 2014-06-10
- Revision:
- 0:40c8edd1ed95
File content as of revision 0:40c8edd1ed95:
#include "mbed.h" Serial pc(USBTX, USBRX); Serial uart(PTD3, PTD2); DigitalOut pc_activity(LED1); DigitalOut uart_activity(LED2); DigitalIn DCD(D4); DigitalIn DSR(D5); DigitalIn DTR(D7); DigitalIn RI(D8); DigitalIn LS(D10); int i; int main() { pc.baud(115200); uart.baud(115200); pc_activity = 1; uart_activity = 1; i = 0; while (i < 2) { wait(1); pc_activity = !pc_activity; i++; } i = 0; while (i < 2) { wait (1); uart_activity = !uart_activity; i++; } printf("Start of Test\n\r"); while(1) { if(pc.readable()) { uart.putc(pc.getc()); pc_activity = !pc_activity; } if(uart.readable()) { pc.putc(uart.getc()); uart_activity = !uart_activity; } } }