Browse Source

feat: Filter out NMEA sentences other than GPRMC

master
Konstantinos Kamaropoulos 5 years ago
parent
commit
5154c803e6
  1. 10
      Aiolos_Drone.ino

10
Aiolos_Drone.ino

@ -16,7 +16,7 @@ void setup() {
pinMode(MQ8, INPUT); pinMode(MQ8, INPUT);
pinMode(MQ9, INPUT); pinMode(MQ9, INPUT);
pinMode(MQ135, INPUT); pinMode(MQ135, INPUT);
Serial.begin(9600); Serial.begin(115200);
Serial3.begin(9600); Serial3.begin(9600);
} }
@ -53,8 +53,10 @@ void loop() {
} }
} }
while (Serial3.available() > 0){ if (Serial3.available() > 0){
byte gpsData = Serial3.read(); String gpsData = Serial3.readStringUntil('\n');
Serial.write(gpsData); if (gpsData.startsWith("$GPRMC")){
Serial.println(gpsData);
}
} }
} }

Loading…
Cancel
Save