Yu Hui Wee / Mbed 2 deprecated GPS_Test

Dependencies:   mbed

Fork of C027_GPSTransparentSerial by u-blox

main.cpp

Committer:
mazgch
Date:
2013-10-25
Revision:
1:0d32baf4a645
Parent:
0:7f124c0a351a
Child:
2:490b4b087576

File content as of revision 1:0d32baf4a645:

#include "mbed.h"
#include "C027.h"

int main() 
{
    C027 c027;
    c027.gpsPower(true);
    
    // open the gps serial port
    Serial gps(GPSTXD, GPSRXD);
    gps.baud(GPSBAUD);
    
    // open the PC serial port and (use the same baudrate)
    Serial pc(USBTX, USBRX);
    pc.baud(GPSBAUD);
    
    while (1)
    {
        // transfer data from pc to gps
        if (pc.readable() && gps.writeable())
            gps.putc(pc.getc());
        // transfer data from gps to pc
        if (gps.readable() && pc.writeable())
            pc.putc(gps.getc());
    }
}