Récupération de trame NMEA

Dependencies:   C12832-font

main.cpp

Committer:
gr91
Date:
2020-11-22
Revision:
9:a9dfb95b5d8a
Parent:
8:23fca4edc6b9
Child:
10:8895b56c630c

File content as of revision 9:a9dfb95b5d8a:

#include "mbed.h"
// Echo
// lien serie via USB avec Terarerm
// GR 2020
// Universite Paris-Saclay - IUT Cachan
RawSerial pc_raw(USBTX, USBRX);  // ou SERIAL-TX, SERIAL_RX  ou PA_2,PA_3
DigitalOut ledB(D8);
void reception_symbole(void);
int main()
{
    pc_raw.baud(115200);
    pc_raw.attach(&reception_symbole);
    pc_raw.printf("Echo test\r\n");
    ledB=0;
    while(1) {
    }
}
void reception_symbole(void)
{
    unsigned char c;
    if(pc_raw.readable()) {
        ledB=!ledB;
        c=pc_raw.getc();
        pc_raw.putc(c);
    }
}