Skip to content

Instantly share code, notes, and snippets.

@TareObjects
Created July 31, 2019 13:51
Show Gist options
  • Select an option

  • Save TareObjects/b0d08259149ecc42546f6f320fcc7df4 to your computer and use it in GitHub Desktop.

Select an option

Save TareObjects/b0d08259149ecc42546f6f320fcc7df4 to your computer and use it in GitHub Desktop.
#include <M5Stack.h>
HardwareSerial mySerial(2); // RX, TX
void setup() {
Serial.begin(115200);
M5.begin();
M5.Lcd.setTextSize(1);
M5.Lcd.setTextColor(WHITE, BLACK);
mySerial.begin(9600);
}
char line[201];
int p = 0;
void loop() {
if (mySerial.available()) {
int c = mySerial.read();
if (c == 13) {
mySerial.read();
line[p] = 0;
Serial.print(line);
if (strstr(line, "GNRMC")) {
M5.Lcd.setCursor(0, 30);
M5.Lcd.printf(line);
Serial.println("<--------------------");
} else {
Serial.println("");
}
p = 0;
} else {
line[p++] = c;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment