From 5154c803e62b33f15d8d2e200910e301d28d21df Mon Sep 17 00:00:00 2001 From: Konstantinos Kamaropoulos Date: Fri, 10 Jan 2020 13:39:12 +0200 Subject: [PATCH] feat: Filter out NMEA sentences other than GPRMC --- Aiolos_Drone.ino | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Aiolos_Drone.ino b/Aiolos_Drone.ino index 4316ecb..ef67b1a 100644 --- a/Aiolos_Drone.ino +++ b/Aiolos_Drone.ino @@ -16,7 +16,7 @@ void setup() { pinMode(MQ8, INPUT); pinMode(MQ9, INPUT); pinMode(MQ135, INPUT); - Serial.begin(9600); + Serial.begin(115200); Serial3.begin(9600); } @@ -53,8 +53,10 @@ void loop() { } } - while (Serial3.available() > 0){ - byte gpsData = Serial3.read(); - Serial.write(gpsData); + if (Serial3.available() > 0){ + String gpsData = Serial3.readStringUntil('\n'); + if (gpsData.startsWith("$GPRMC")){ + Serial.println(gpsData); + } } }