Read UART at 4800 then Resend thru the USB

Dependencies:   mbed

main.cpp

Committer:
icis4
Date:
2016-01-28
Revision:
2:2fc8495988a0
Parent:
1:221b87b26f53

File content as of revision 2:2fc8495988a0:

#include "mbed.h"

//------------------------------------
// Hyperterminal configuration
// 9600 bauds, 8-bit data, no parity
//------------------------------------

Serial pc(SERIAL_TX, SERIAL_RX);
Serial gps(PB_10, PC_5);

int main()
{
    uint8_t c;
    
    pc.baud(4800);
    gps.baud(4800);
    
    pc.printf("*** GPS ***\n");
    while(1) {
        if (gps.readable()) {
            c = gps.getc();
            pc.putc(c);
        }
        if (pc.readable()) {
            c = pc.getc();
            gps.putc(c);
        }
    }
}