#include <TinyGPS++.h>
#include <SoftwareSerial.h>
TinyGPSPlus gps;
SoftwareSerial ss(4, 3);
char msg_line[270];
char read;
int i = 0;
void setup() {
// put your setup code here, to run once:
Serial.begin(38400);
ss.begin(38400);
}
void loop() {
// put your main code here, to run repeatedly:
if (ss.available()) {
//Serial.print((char)Serial1.read());
msg_line[i++] = (char)ss.read(); // read each character into the list
//Serial.print(msg_line);
if(i >= 182) {
int ii = 0;
while(ii<i){
if(ii+88 < 270 && msg_line[ii] == '$' && msg_line[ii+1] == 'G' && msg_line[ii+2] == 'N' && msg_line[ii+3] == 'R' && msg_line[ii+4] == 'M' && msg_line[ii+5] == 'C'){ //对MC那一行进行提取
int t = ii;
while(t< ii+88){
Serial.print(msg_line[t]);
t++;}
}
ii++;
}
//memset(msg_line, 0, 270);
i = 0;
} //clear info
//Serial.print((char)Serial1.read());
}
}
想要从GNRMC中单独把航向信息显示出来,不知道怎么弄了,这个程序是GNRMC显示程序,求大神指点,怎样写程序才能把航向信息解析出来
|