Switch branches/tags
Nothing to show
Find file
e70815b Jan 20, 2012
72 lines (58 sloc) 2.49 KB
// Test code for Adafruit GPS modules using MTK driver
// such as
// Pick one up today at the Adafruit electronics shop
// and help support open source hardware & software! -ada
#if (ARDUINO >= 100)
#include <SoftSerial.h>
SoftSerial mySerial(2, 3);
// If you're using Arduino IDE v23 or earlier, you'll
// need to install NewSoftSerial
#include <NewSoftSerial.h>
NewSoftSerial mySerial(2, 3);
// Connect the GPS Power pin to 3.3V
// Connect the GPS Ground pin to ground
// Connect the GPS VBAT pin to 3.3V if no battery is used
// Connect the GPS TX (transmit) pin to Digital 2
// Connect the GPS RX (receive) pin to Digital 3
// For 3.3V only modules such as the UP501, connect a 10K
// resistor between digital 3 and GPS RX and a 10K resistor
// from GPS RX to ground.
// different commands to set the update rate from once a second (1 Hz) to 10 times a second (10Hz)
#define PMTK_SET_NMEA_UPDATE_1HZ "$PMTK220,1000*1F"
#define PMTK_SET_NMEA_UPDATE_5HZ "$PMTK220,200*2C"
#define PMTK_SET_NMEA_UPDATE_10HZ "$PMTK220,100*2F"
// turn on only the second sentence (GPRMC)
#define PMTK_SET_NMEA_OUTPUT_RMCONLY "$PMTK314,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0*29"
// turn on ALL THE DATA
#define PMTK_SET_NMEA_OUTPUT_ALLDATA "$PMTK314,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0*28"
// to generate your own sentences, check out the MTK command datasheet and use a checksum calculator
// such as the awesome
void setup()
Serial.println("Adafruit MTK3329 NMEA test!");
// 9600 NMEA is the default baud rate
// uncomment this line to turn on only the "minimum recommended" data for high update rates!
// uncomment this line to turn on all the available data - for 9600 baud you'll want 1 Hz rate
// Set the update rate
// 1 Hz update rate
// 5 Hz update rate- for 9600 baud you'll have to set the output to RMC only (see above)
// 10 Hz update rate - for 9600 baud you'll have to set the output to RMC only (see above)
void loop() // run over and over again
if (mySerial.available()) {
if (Serial.available()) {