Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
main.cpp
- Committer:
- dongyanzhi
- Date:
- 2017-06-09
- Revision:
- 0:3ba942901d6e
File content as of revision 0:3ba942901d6e:
#include "mbed.h" #include <cstring> Serial pc(SERIAL_TX, SERIAL_RX); //USART2 Serial gps(D1,D0); //USART1 DigitalOut myled(LED1); char buffer[256]; void getline(); void callback() { getline(); } volatile int sig=0; volatile int i=0; int main() { pc.printf("start test!\r\n"); gps.attach(&callback); while(1) { hal_sleep(); if(sig == 7) { sig=0; i=0; pc.printf("%s",buffer); memset(buffer,0,sizeof(buffer)); } } } void getline() { buffer[i] = gps.getc(); if(buffer[i] == 0x0a) { sig++; } i++; }