Dependancies
Pre-requisites
Buy the components
gps-parsing-esp32-t-beam.ino
#include "src/gps/gps.h"
int interval = 2000;
long lastSendTime = 0;
LatLong latlong = {0.0, 0.0};
void setup() {
initGPS();
Serial.begin(115200);
Serial.println("Hello GPS");
}
void loop() {
// Get GPS data as soon as it is available,
// But display it on the serial monitor only every 2 seconds
while (isGPSAvailable()) {
getLatLong(&latlong);
}
if (millis() - lastSendTime > interval) {
Serial.print(millis());
Serial.print(" Lat-Long: ");
Serial.print(latlong.latitude, 7);
Serial.print(", ");
Serial.println(latlong.longitude, 7);
lastSendTime = millis();
}
}
BOARD?=esp32:esp32:t-beam
PORT?=/dev/cu.SLAB_USBtoUART
.PHONY: default lint all flash clean
default: all flash clean
lint:
cpplint --extensions=ino --filter=-legal/copyright *.ino
all:
arduino-cli compile --fqbn $(BOARD) ./
flash:
arduino-cli upload -p $(PORT) --fqbn $(BOARD)
clean:
rm -r build
This example contains displaying latitude and longitude from uBlox Neo-6M module on the serial monitor on a ESP-32 based LilyGO T-Beam T22_V1.1, 20191212
. Pins IO12
is used as TX
and pin IO34
is used as RX
as shown in the schematic for V1.1.
make
command.