I'm working on a project which involves interfacing between the Arduino Zero and the Parallax PAM7Q GPS Module. Parallax provides some demonstration code to test out on the Arduino, but sadly doesn't work with the Zero. I know it has something to do with the Zero not having the SoftwareSerial library, but I'm not sure how I need to modify the code to make it work. I have included the Demo code provided.
/*
Demonstration code for the Parallax PAM-7Q module, #28509
This code uses the default factory settings of the PAM-7Q module.
The GPS output is displayed in the Arduino Serial Terminal Window.
After uploading the sketch open this window to view the output.
Make sure the baud rate is set to 9600.
Numeric output is shown as signed latitude and longitude degrees and
minutes. Values may be directly copied and pasted into the location bar
of Google Maps to visually show your location.
For best results use the PAM-7Q module outdoors, or near an open window.
Use indoors away from windows may result in inconsistent results.
This example code is for the Arduino Uno and direct compatible boards.
It has not been tested, nor designed for, other Arduino boards, including
the Arduino Due.
Important: This version is intended for Arduino 1.0 or later IDE. It will
not compile in earlier versions. Be sure the following files are
present in the folder with this sketch:
TinyGPS.h
TinyGPS.cpp
keywords.txt
A revised version of the TinyGPS object library is included in the sketch folder
to avoid conflict with any earlier version you may have in the Arduino libraries
location.
Connections:
PAM-7Q Arduino
GND GND
VDD 5V
TXD Digital Pin 6
Reminder! Wait for the satellite lock LED to begin flashing before
taking readings. The flashing LED indicates satellite lock. Readings taken
before satellite lock may be inaccurate.
*/
#include <SoftwareSerial.h>
#include "./TinyGPS.h" // Use local version of this library
TinyGPS gps;
SoftwareSerial nss(6, 255); // TXD to digital pin 6
void setup() {
Serial.begin(115200);
nss.begin(9600); // Communicate at 9600 baud (default for PAM-7Q module)
Serial.println("Reading GPS");
}
void loop() {
bool newdata = false;
unsigned long start = millis();
while (millis() - start < 5000) { // Update every 5 seconds
if (feedgps())
newdata = true;
}
if (newdata) {
gpsdump(gps);
}
}
// Get and process GPS data
void gpsdump(TinyGPS &gps) {
float flat, flon;
unsigned long age;
gps.f_get_position(&flat, &flon, &age);
Serial.print(flat, 4); Serial.print(", ");
Serial.println(flon, 4);
}
// Feed data as it becomes available
bool feedgps() {
while (nss.available()) {
if (gps.encode(nss.read()))
return true;
}
return false;
}
The error reads as:
fatal error: SoftwareSerial.h: No such file or directory
Any help would be much appreciated.