42 lines
1.0 KiB
C++
42 lines
1.0 KiB
C++
#include <Adafruit_GPS.h>
|
|
#include <SoftwareSerial.h>
|
|
Adafruit_GPS GPS(&Serial1);
|
|
|
|
// Set GPSECHO to 'false' to turn off echoing the GPS data to the Serial console
|
|
// Set to 'true' if you want to debug and listen to the raw GPS sentences
|
|
#define GPSECHO true
|
|
|
|
// this keeps track of whether we're using the interrupt
|
|
// off by default!
|
|
boolean usingInterrupt = false;
|
|
|
|
void setup()
|
|
{
|
|
while (!Serial);
|
|
// connect at 115200 so we can read the GPS fast enuf and
|
|
// also spit it out
|
|
Serial.begin(115200);
|
|
Serial.println("Adafruit GPS logging dump test!");
|
|
|
|
// 9600 NMEA is the default baud rate for MTK - some use 4800
|
|
GPS.begin(9600);
|
|
|
|
GPS.sendCommand(PMTK_SET_NMEA_OUTPUT_OFF);
|
|
|
|
while (Serial1.available())
|
|
Serial1.read();
|
|
|
|
delay(1000);
|
|
GPS.sendCommand("$PMTK622,1*29");
|
|
Serial.println("----------------------------------------------------");
|
|
}
|
|
|
|
|
|
void loop() // run over and over again
|
|
{
|
|
if (Serial1.available()) {
|
|
char c = Serial1.read();
|
|
if (c) Serial.print(c);
|
|
}
|
|
}
|