Download ECE499-Design Report Paper

Transcript
ECE499
Design Report
Winter 2015
Arduino Code:
The following code is an excerpt of open source code that was written for the Adafruit
Ultimate GPS logger. This software was downloaded from: https://github.com/adafruit/
Adafruit-GPS-Library and the code was adapted and organized to fit the correct serial
setup, baud rate and refresh rate for the GPS unit. In addition, the code was used to
determine which NMEA GPS sentences were output when logging. There is additional
code involved with the Arduino software; however, it is too long to fit into this appendix,
so the following example for SD logging is shown.
// Code for logging GPS data onto an SD card after recording satellite fixed data
// Libraries used for Code
#include <SPI.h>
#include <Adafruit_GPS.h>
#include <SoftwareSerial.h>
#include <SD.h>
#include <avr/sleep.h>
// This code shows how to listen to the GPS module in an interrupt
// which allows the program to have more 'freedom' - just parse
// when a new NMEA sentence is available then access the data when desired
SoftwareSerial mySerial(8, 7);
Adafruit_GPS GPS(&mySerial);
// 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
// Set to true to only log to SD when GPS has a fix, for debugging, keep it false //
#define LOG_FIXONLY false
// Interrupt is off by default
boolean usingInterrupt = false;
void useInterrupt(boolean);
// Set the pins used on the Arduino
#define chipSelect 10
#define ledPin 13
File logfile;
// Read in a hexadecimal value and return the decimal equivalent
uint8_t parseHex(char c) {
if (c < '0')
return 0;
if (c <= '9')
55