Hi all
Im posting this as it may well help any of you who are trying to get seeduino stalker2.1 and ublox gps
to run.
Ive been working on this for about two months and am finally making some progress in spite of poor responses
to requests for help to get this stuff to work not only this site but also processing and the arduino sites
however I havent made that many requests
the code below works in a fashion but please remember its hacked together from other sketches (mostly on the processing side .Im very new to this electronics and coding so dont think that i know what im doing
its all been trial and error and lots and lots of time
I hope its some help to someone
hardware
I had problems with the wiring of the ublox gps it dident work just by plugging into its slot on the
stalker ive had to wire from the gps rx pin to pin 3 tx to pin 2 on the stalker it works but im not
certain if the data logged is clean the gprmc samlpe file is one of the first logs i managed to get and does
not reflect acurately my actural trip so beware.Ive have recently managed to get . csv logs which look
alot cleaner
tom igoes gps parser works with this kit in processing over serial and ive modified it to read from text file
the sample codes that have been successful are tiny gps, newsoft serial , seedstudios ,ladyarda provide
two slightly different samples, the one that ive had success with refers to two versions of arduino- late and early. the sample that is provided with the fat 16 lib ive not had any luck with as yet but it does work with the sample below
.csv code
[code]#include <NewSoftSerial.h>
NewSoftSerial nss(2, 3);
// Ladyada’s logger modified by Bill Greiman to use the Fat16 library
// this is a generic logger that does checksum testing so the data written should be always good
// Assumes a sirf III chipset logger attached to pin 0 and 1
uint8_t sensorCount = 3; //number of analog pins to log
#include <Fat16.h>
#include <Fat16util.h>
// macros to use PSTR
#define putstring(str) SerialPrint_P(PSTR(str))
#define putstring_nl(str) SerialPrintln_P(PSTR(str))
#define isdigit(x) ( x >= ‘0’ && x <= ‘9’)
//extern uint16_t _end;
SdCard card;
Fat16 f;
#define led1Pin 7 // LED1 connected to digital pin 4
#define led2Pin 4 // LED2 connected to digital pin 3
#define powerpin 0 // GPS power control
// set the RX_BUFFER_SIZE to 32!
#define BUFFSIZE 73 // we buffer one NMEA sentense at a time, 83 bytes is longer than the max length
char buffer[BUFFSIZE]; // this is the double buffer
char buffer2[12];
uint8_t bufferidx = 0;
uint32_t tmp;
#define LOG_RMC 1 // essential location data
#define RMC_ON “$GPRMC,\r\n" // the command we send to turn RMC on (1 hz rate)
//#define RMC_OFF "$PSRF103,4,0,0,120\r\n” // the command we send to turn RMC off
#define LOG_GGA 0 // contains fix, hdop & vdop data
//#define GGA_ON “$PSRF103,0,0,1,125\r\n" // the command we send to turn GGA on (1 hz rate)
//#define GGA_OFF "$PSRF103,0,0,0,124\r\n” // the command we send to turn GGA off
#define LOG_GSA 0 // satelite data
//#define GSA_ON “$PSRF103,2,0,1,127\r\n" // the command we send to turn GSA on (1 hz rate)
//#define GSA_OFF "$PSRF103,2,0,0,126\r\n” // the command we send to turn GSA off
#define LOG_GSV 0 // detailed satellite data
#define GSV_ON “$,\r\n" // the command we send to turn GSV on (1 hz rate)
//#define GSV_OFF "$PSRF103,3,0,0,127\r\n” // the command we send to turn GSV off
#define LOG_GLL 0 // Loran-compatibility data
// this isnt output by default
//#define USE_WAAS 1 // useful in US, but slower fix
//#define WAAS_ON “$PSRF151,13F\r\n" // the command for turning on WAAS
//#define WAAS_OFF "$PSRF151,03E\r\n” // the command for turning off WAAS
#define LOG_RMC_FIXONLY 1 // log only when we get RMC’s with fix?
uint8_t fix = 0; // current fix data
// read a Hex value and return the decimal equivalent
uint8_t parseHex(char c) {
if (c < ‘0’)
return 0;
if (c <= ‘9’)
return c - ‘0’;
if (c < ‘A’)
return 0;
if (c <= ‘F’)
return (c - ‘A’)+10;
}
uint8_t i;
// blink out an error code
void error(uint8_t errno) {
while(1) {
for (i=0; i<errno; i++) {
digitalWrite(led1Pin, HIGH);
digitalWrite(led2Pin, HIGH);
delay(100);
digitalWrite(led1Pin, LOW);
digitalWrite(led2Pin, LOW);
delay(100);
}
for (; i<10; i++) {
delay(200);
}
}
}
void setup() // run once, when the sketch starts
{
Serial.begin(9600);
nss.begin(9600);
putstring_nl(“GPSlogger”);
pinMode(led1Pin, OUTPUT); // sets the digital pin as output
pinMode(led2Pin, OUTPUT); // sets the digital pin as output
pinMode(powerpin, OUTPUT);
digitalWrite(powerpin, LOW);
if (!card.init()) {
putstring_nl(“Card init. failed!”);
error(1);
}
if (!Fat16::init(&card)) {
putstring_nl(“No partition!”);
error(2);
}
strcpy(buffer, “GPSLOG00.CSV”);
for (i = 0; i < 100; i++) {
buffer[6] = ‘0’ + i/10;
buffer[7] = ‘0’ + i%10;
// create if does not exist, do not open existing, write
if (f.open(buffer, O_CREAT | O_EXCL | O_WRITE)) break;
}
if(!f.isOpen()) {
putstring("couldnt create "); nss.println(buffer);
error(3);
}
putstring("writing to "); nss.println(buffer);
putstring_nl(“ready!”);
// write header
if (sensorCount > 6) sensorCount = 6;
strncpy_P(buffer, PSTR(“time,lat,long,speed,date,sens0,sens1,sens2,sens3,sens4,sens5”), 24 + 6*sensorCount);
nss.println(buffer);
// clear write error
f.writeError = false;
f.println(buffer);
if (f.writeError || !f.sync()) {
putstring_nl(“can’t write header!”);
error(4);
}
delay(1000);
putstring("\r\n");
//#if USE_WAAS == 1
// putstring(WAAS_ON); // turn on WAAS
//#else
// putstring(WAAS_OFF); // turn on WAAS
//#endif
#if LOG_RMC == 1
putstring(RMC_ON); // turn on RMC
#else
// putstring(RMC_OFF); // turn off RMC
#endif
#if LOG_GSV == 1
putstring(GSV_ON); // turn on GSV
#else
// putstring(GSV_OFF); // turn off GSV
#endif
#if LOG_GSA == 1
putstring(GSA_ON); // turn on GSA
#else
// putstring(GSA_OFF); // turn off GSA
#endif
#if LOG_GGA == 1
putstring(GGA_ON); // turn on GGA
#else
//putstring(GGA_OFF); // turn off GGA
#endif
}
void loop() // run over and over again
{
//Serial.println(Serial.available(), DEC);
char c;
uint8_t sum;
// read one ‘line’
if (nss.available()) {
c = nss.read();
//Serial.write©;
if (bufferidx == 0) {
while (c != ‘$’)
c = nss.read(); // wait till we get a $
}
buffer[bufferidx] = c;
Serial.write©;
if (c == ‘\n’) {
putstring_nl(“EOL”);
Serial.print(buffer);
buffer[bufferidx+1] = 0; // terminate it
if (buffer[bufferidx-4] != '*') {
// no checksum?
Serial.write('*');
bufferidx = 0;
return;
}
// get checksum
sum = parseHex(buffer[bufferidx-3]) * 16;
sum += parseHex(buffer[bufferidx-2]);
// check checksum
for (i=1; i < (bufferidx-4); i++) {
sum ^= buffer[i];
}
if (sum != 0) {
putstring_nl("Cxsum mismatch");
Serial.write('~');
bufferidx = 0;
return;
}
// got good data!
if (strstr(buffer, "GPRMC")) {
// find out if we got a fix
char* p = buffer;
p = strchr(p, ',')+1;
p = strchr(p, ',')+1; // skip to 3rd item
if (p[0] == 'V') {
digitalWrite(led1Pin, LOW);
fix = 0;
} else {
digitalWrite(led1Pin, HIGH);
fix = 1;
}
} else {
// not GPRMC
bufferidx = 0;
return;
}
#if LOG_RMC_FIXONLY
if (!fix) {
Serial.write(’_’);
bufferidx = 0;
return;
}
#endif
// rad. lets print it!
Serial.print(buffer);
// time to clean up the string
// find time
char* p = buffer;
p = strchr(p, ',')+1;
buffer[0] = p[0];
buffer[1] = p[1];
buffer[2] = ':';
buffer[3] = p[2];
buffer[4] = p[3];
buffer[5] = ':';
buffer[6] = p[4];
buffer[7] = p[5];
// we ignore milliseconds
buffer[8] = ',';
p = strchr(buffer+8, ',')+1;
// skip past 'active' flag
p = strchr(p, ',')+1;
// find lat
p = strchr(p, ',')+1;
buffer[9] = '+';
buffer[10] = p[0];
buffer[11] = p[1];
buffer[12] = ' ';
strncpy(buffer+13, p+2, 7);
buffer[20] = ',';
p = strchr(buffer+21, ',')+1;
if (p[0] == 'S')
buffer[9] = '-';
// find long
p = strchr(p, ',')+1;
buffer[21] = '+';
buffer[22] = p[0];
buffer[23] = p[1];
buffer[24] = p[2];
buffer[25] = ' ';
strncpy(buffer+26, p+3, 7);
buffer[33] = ',';
p = strchr(buffer+34, ',')+1;
if (p[0] == 'W')
buffer[21] = '-';
// find speed
p = strchr(p, ',')+1;
tmp = 0;
if (p[0] != ',') {
// ok there is some sort of speed
while (p[0] != '.' && p[0] != ',') {
tmp *= 10;
tmp += p[0] - '0';
p++;
}
tmp *= 10;
if (isdigit(p[1]))
tmp += p[1] - '0'; // tenths
tmp *= 10;
if (isdigit(p[2]))
tmp += p[2] - '0'; // hundredths
// tmp is knots * 100
// convert to mph (1.15 mph = 1 knot)
tmp *= 115;
// -OR- convert km/h
// tmp *= 185
}
tmp /= 100;
buffer[34] = (tmp / 10000) + '0';
tmp %= 10000;
buffer[35] = (tmp / 1000) + '0';
tmp %= 1000;
buffer[36] = (tmp / 100) + '0';
tmp %= 100;
buffer[37] = '.';
buffer[38] = (tmp / 10) + '0';
tmp %= 10;
buffer[39] = tmp + '0';
buffer[40] = ',';
p = strchr(p, ',')+1;
// skip past bearing
p = strchr(p, ',')+1;
//mod for bug when speed,bearing are missing (bill greiman)
uint8_t date[6];
for (uint8_t id = 0; id < 6; id++) date[id] = p[id];
// get date into 2001-01-31 style
buffer[41] = '2';
buffer[42] = '0';
buffer[43] = date[4];
buffer[44] = date[5];
buffer[45] = '-';
buffer[46] = date[2];
buffer[47] = date[3];
buffer[48] = '-';
buffer[49] = date[0];
buffer[50] = date[1];
buffer[51] = 0;
digitalWrite(led2Pin, HIGH);
if(f.write((uint8_t*) buffer, 51) != 51) {
putstring_nl("can't write fix!");
return;
}
Serial.print(buffer);
// clear write error
f.writeError = false;
// add sensor data
for (uint8_t ia = 0; ia < sensorCount; ia++) {
Serial.write(',');
f.write(',');
uint16_t data = analogRead(ia);
Serial.print(data);
f.print(data);
}
Serial.println();
f.println();
if (f.writeError || !f.sync()) {
putstring_nl("can't write data!");
return;
}
digitalWrite(led2Pin, LOW);
bufferidx = 0;
return;
}
bufferidx++;
if (bufferidx == BUFFSIZE-1) {
Serial.write('!');
bufferidx = 0;
}
}
}
[/code] .text example [code]
// this is a generic logger that does checksum testing so the data written should be always good
// Assumes a sirf III chipset logger attached to pin 2 and 3
#include <SD.h>
#include <avr/sleep.h>
#include “GPSconfig.h”
// If using Arduino IDE prior to 1.0,
// make sure to install newsoftserial from Mikal Hart
// http://arduiniana.org/libraries/NewSoftSerial/
#if ARDUINO >= 100
#include <SoftwareSerial.h>
#else
#include <NewSoftSerial.h>
#endif
// power saving modes
#define SLEEPDELAY 0
#define TURNOFFGPS 0
#define LOG_RMC_FIXONLY 0
// what to log
#define LOG_RMC 1 // RMC-Recommended Minimum Specific GNSS Data, message 103,04
//#define LOG_GGA 0 // GGA-Global Positioning System Fixed Data, message 103,00
//#define LOG_GLL 0 // GLL-Geographic Position-Latitude/Longitude, message 103,01
//#define LOG_GSA 0 // GSA-GNSS DOP and Active Satellites, message 103,02
//#define LOG_GSV 0 // GSV-GNSS Satellites in View, message 103,03
//#define LOG_VTG 0 // VTG-Course Over Ground and Ground Speed, message 103,05
// Use pins 2 and 3 to talk to the GPS. 2 is the TX pin, 3 is the RX pin
#if ARDUINO >= 100
SoftwareSerial gpsSerial = SoftwareSerial(2, 3);
#else
NewSoftSerial gpsSerial = NewSoftSerial(2, 3);
#endif
// Set the GPSRATE to the baud rate of the GPS module. Most are 4800
// but some are 38400 or other. Check the datasheet!
#define GPSRATE 9600
// Set the pins used
#define powerPin 0
#define led1Pin 7
#define led2Pin 4
#define chipSelect 10
#define BUFFSIZE 90
char buffer[BUFFSIZE];
uint8_t bufferidx = 0;
uint8_t fix = 0; // current fix data
uint8_t i;
File logfile;
// read a Hex value and return the decimal equivalent
uint8_t parseHex(char c) {
if (c < ‘0’)
return 0;
if (c <= ‘9’)
return c - ‘0’;
if (c < ‘A’)
return 0;
if (c <= ‘F’)
return (c - ‘A’)+10;
}
// blink out an error code
void error(uint8_t errno) {
/*
if (SD.errorCode()) {
putstring("SD error: ");
Serial.print(card.errorCode(), HEX);
Serial.print(’,’);
Serial.println(card.errorData(), HEX);
}
*/
while(1) {
for (i=0; i<errno; i++) {
digitalWrite(led1Pin, HIGH);
digitalWrite(led2Pin, HIGH);
delay(100);
digitalWrite(led1Pin, LOW);
digitalWrite(led2Pin, LOW);
delay(100);
}
for (; i<10; i++) {
delay(200);
}
}
}
void setup() {
WDTCSR |= (1 << WDCE) | (1 << WDE);
WDTCSR = 0;
Serial.begin(115200);
Serial.println("\r\nGPSlogger");
pinMode(led1Pin, OUTPUT);
pinMode(led2Pin, OUTPUT);
pinMode(powerPin, OUTPUT);
digitalWrite(powerPin, LOW);
// make sure that the default chip select pin is set to
// output, even if you don’t use it:
pinMode(10, OUTPUT);
// see if the card is present and can be initialized:
if (!SD.begin(chipSelect)) {
Serial.println(“Card init. failed!”);
error(1);
}
strcpy(buffer, “GPSLOG00.TXT”);
for (i = 0; i < 100; i++) {
buffer[6] = ‘0’ + i/10;
buffer[7] = ‘0’ + i%10;
// create if does not exist, do not open existing, write, sync after write
if (! SD.exists(buffer)) {
break;
}
}
logfile = SD.open(buffer, FILE_WRITE);
if( ! logfile ) {
Serial.print("Couldnt create "); Serial.println(buffer);
error(3);
}
Serial.print("Writing to "); Serial.println(buffer);
// connect to the GPS at the desired rate
gpsSerial.begin(GPSRATE);
Serial.println(“Ready!”);
gpsSerial.print(SERIAL_SET);
delay(250);
//#if (LOG_DDM == 1)
// gpsSerial.print(DDM_ON);
//#else
// gpsSerial.print(DDM_OFF);
//#endif
// delay(250);
//#if (LOG_GGA == 1)
// gpsSerial.print(GGA_ON);
//#else
// gpsSerial.print(GGA_OFF);
//#endif
// delay(250);
//#if (LOG_GLL == 1)
// gpsSerial.print(GLL_ON);
//#else
// gpsSerial.print(GLL_OFF);
//#endif
// delay(250);
//#if (LOG_GSA == 1)
// gpsSerial.print(GSA_ON);
//#else
// gpsSerial.print(GSA_OFF);
//#endif
// delay(250);
//#if (LOG_GSV == 1)
// gpsSerial.print(GSV_ON);
//#else
// gpsSerial.print(GSV_OFF);
//#endif
delay(250);
#if (LOG_RMC == 1)
gpsSerial.print(RMC_ON);
#else
gpsSerial.print(RMC_OFF);
#endif
delay(250);
//#if (LOG_VTG == 1)
// gpsSerial.print(VTG_ON);
//#else
// gpsSerial.print(VTG_OFF);
//#endif
// delay(250);
//#if (USE_WAAS == 1)
// gpsSerial.print(WAAS_ON);
//#else
// gpsSerial.print(WAAS_OFF);
//#endif
}
void loop() {
//Serial.println(Serial.available(), DEC);
char c;
uint8_t sum;
// read one ‘line’
if (gpsSerial.available()) {
c = gpsSerial.read();
#if ARDUINO >= 100
//Serial.write©;
#else
//Serial.print(c, BYTE);
#endif
if (bufferidx == 0) {
while (c != ‘$’)
c = gpsSerial.read(); // wait till we get a $
}
buffer[bufferidx] = c;
#if ARDUINO >= 100
//Serial.write©;
#else
//Serial.print(c, BYTE);
#endif
if (c == ‘\n’) {
//putstring_nl(“EOL”);
//Serial.print(buffer);
buffer[bufferidx+1] = 0; // terminate it
if (buffer[bufferidx-4] != '*') {
// no checksum?
Serial.print('*');
bufferidx = 0;
return;
}
// get checksum
sum = parseHex(buffer[bufferidx-3]) * 16;
sum += parseHex(buffer[bufferidx-2]);
// check checksum
for (i=1; i < (bufferidx-4); i++) {
sum ^= buffer[i];
}
if (sum != 0) {
//putstring_nl("Cxsum mismatch");
Serial.print('~');
bufferidx = 0;
return;
}
// got good data!
if (strstr(buffer, "GPRMC")) {
// find out if we got a fix
char *p = buffer;
p = strchr(p, ',')+1;
p = strchr(p, ',')+1; // skip to 3rd item
if (p[0] == 'V') {
digitalWrite(led1Pin, LOW);
fix = 0;
} else {
digitalWrite(led1Pin, HIGH);
fix = 1;
}
}
if (LOG_RMC_FIXONLY) {
if (!fix) {
Serial.print('_');
bufferidx = 0;
return;
}
}
// rad. lets log it!
Serial.print(buffer);
Serial.print('#');
digitalWrite(led2Pin, HIGH); // sets the digital pin as output
// Bill Greiman - need to write bufferidx + 1 bytes to getCR/LF
bufferidx++;
logfile.write((uint8_t *) buffer, bufferidx);
logfile.flush();
/*
if( != bufferidx) {
putstring_nl("can't write!");
error(4);
}
*/
digitalWrite(led2Pin, LOW);
bufferidx = 0;
// turn off GPS module?
if (TURNOFFGPS) {
digitalWrite(powerPin, HIGH);
}
delay(SLEEPDELAY * 1000);
digitalWrite(powerPin, LOW);
return;
}
bufferidx++;
if (bufferidx == BUFFSIZE-1) {
Serial.print('!');
bufferidx = 0;
}
} else {
}
}
void sleep_sec(uint8_t x) {
while (x–) {
// set the WDT to wake us up!
WDTCSR |= (1 << WDCE) | (1 << WDE); // enable watchdog & enable changing it
WDTCSR = (1<< WDE) | (1 <<WDP2) | (1 << WDP1);
WDTCSR |= (1<< WDIE);
set_sleep_mode(SLEEP_MODE_PWR_DOWN);
sleep_enable();
sleep_mode();
sleep_disable();
}
}
SIGNAL(WDT_vect) {
WDTCSR |= (1 << WDCE) | (1 << WDE);
WDTCSR = 0;
}
/* End code */
[/code]
heres the processing sketch that im using for it to work with a different set of gps coords
the map coords will need to be edited or a out of bounds exception will be thrown
[code]import controlP5.*;
ControlP5 controlP5;
int time;
boolean playPause = true; // true = play, false = pause
boolean revPause = true; // true = rev, false = pause
void play() { playPause = !playPause; } // toggle
void rev() { revPause = !revPause; } // toggle
//-----------------
String[] lines;
int index = 0;
//---------
float latitude =0.0;
String northSouth;
float longitude = 0.0;
String eastWest;
float heading = 0.0;
float COG =0.0;
float speed =0.0;
int hrs,mins,secs;
int thisDay, thisMonth,thisYear;
//-----------------------------------
float x;
float y;
PImage raster;
//-------
void setup(){
size(1000,600);
// background(0);
smooth();
controlP5 = new ControlP5(this);
controlP5.addSlider(“back”,0,width,10,height-55,width-75,20);
controlP5.addButton(“rev”,0,width-40,height-55,30,20);
controlP5.addSlider(“time”,0,width,10,height-30,width-75,20);
controlP5.addButton(“play”,0,width-40,height-30,30,20);
//}
PFont myFont =createFont(PFont.list()[2],24);
textFont(myFont);
//-------------
ellipseMode(CENTER);
smooth();
frameRate(10);
lines = loadStrings(“gprmc.txt”);
println(“there are " + lines.length + " lines”);
for (int index=0; index < lines.length; index++) {
println(lines[index]);
}
}
void draw (){ if (playPause) { time++; controlP5.controller(“play”).setLabel(“STOP”); }
else { controlP5.controller(“play”).setLabel(“Play”); }
if (revPause) { time++; controlP5.controller(“rev”).setLabel(“back”); }
else { controlP5.controller(“play”).setLabel(“Play”); }
if (time >= width) { time = 0; } // reset when right side is reached (only useful for this particular sketch)
controlP5.controller(“time”).setValue(time); // set the slider to time value
if (revPause) { time–; controlP5.controller(“rev”).setLabel(“back”); }
else { controlP5.controller(“back”).setLabel(“rev”); }
//randomSeed(1); // controls the randomness, to get the same output every time
for (int i=index; i<time; i++) { // the time variable controls the output
float c = map(i,0,time,0,255);
fill(255,255,255);
// }
background(0);
fill(255);
text(thisMonth+"/"+thisDay+"/"+thisYear,50,30);
text(hrs+":"+mins+":"+secs +" ",50,50);
text(“Lng” +" " +eastWest, 50,70);
text(“Lat " +” “+northSouth , 50,90);
text(“heading “+ heading + “degrees”,50,110);
// text(hrs+”:”+mins+”:"+secs +"GMT ",50,130);
//text(“Lat " +” "+northSouth , 50,130);
// text("heading "+ heading + “degrees”,50,150);
text("Speed M/Sec "+ speed ,50,170);
if (index < lines.length) {
String[] pieces = split(lines[index], ‘,’);
int time = int(pieces[1]);
if (pieces.length == 13) {
float latitude = float(pieces[3]) / 100;
float longitude = float(pieces[5]) /100;
heading = float (pieces[7])*100.0;
northSouth = (pieces[5]);
eastWest = (pieces [3]);
speed = float(pieces [7]);
COG = float(pieces [8]);
int date = int (pieces[9]);
thisYear =date%100+2000;
//second two digits are month
thisMonth =(date%10000)/100;
//first two digits of date are day
thisDay = date/10000 ;
if (pieces.length == 13) {float mapX = float(pieces[3]);
float mapY = float(pieces[5]);
// println(mapX + " " + mapY);
println(pieces);
float w_start = 00048.0990; // Longtitude start (largest longitude value)
float w_end = 00048.06929; // Longtitude end (smallest longitude value)
float h_start = 5120.1023; // Latitude start (largest latitude value)
float h_end = 5120.060012; // Latitude end (smallest latitude value)
int mapX1 = 0;
int mapX2 = width;
int mapY1 = 0;
int mapY2 = height;
x = int(((180+mapY)/360)*width);
y = int(height - ((90+mapX)/180)*height);
x = map(mapY, w_start, w_end, mapX1, mapX2);
y = map(mapX, h_end, h_start, mapY1, mapY2);
ellipse(x, y, 10, 10);
hrs= time/1000;
//second two digits=minutes
mins = (time%10000)/100;
//last two digits =seconds
secs = (time%100);}
}
//{ //drawArrow(COG);
}
// }
// }
//--------------
// void drawArrow (float angle){
// translate(width/2,height/2);
//fill(80,200,230);
//ellipse(0,0,50,50);
// fill (0);
// rotate(radians(angle));
//draw the arrow .centre of arrow is at 0.0
// triangle (-10,0,0,-20,10,0);
// rect(-2,0,4,20);{
//}
// }
// point(x, y);
// }
// Go to the next line for the next run through draw()
index = index +1;
}
}
[/code]
sample gprmc off the ublox/stalker $GPRMC,125924.00,A,5120.07122,N,00048.08916,E,0.081,,221211,,,A*79
$GPRMC,125925.00,A,5120.07131,N,00048.08929,E,0.096,,221211,,,A*70
$GPRMC,125926.00,A,5120.07125,N,00048.08864,E,0.117,,221211,,,A*76
$GPRMC,125927.00,A,5120.07127,N,00048.08883,E,0.279,,221211,,,A*77
$GPRMC,125928.00,A,5120.07137,N,00048.08842,E,0.490,,221211,,,A*75
$GPRMC,125930.00,A,5120.07136,N,00048.08822,E,0.782,,221211,,,A*7B
$GPRMC,125932.00,A,5120.07125,N,00048.08877,E,0.803,,221211,,,A*7D
$GPRMC,125934.00,A,5120.07026,N,00048.08660,E,0.408,,221211,,,A*76
$GPRMC,125936.00,A,5120.06974,N,00048.08493,E,0.024,,221211,,,A*7F
$GPRMC,125937.00,A,5120.06959,N,00048.08464,E,0.072,,221211,,,A*7A
$GPRMC,125938.00,A,5120.06950,N,00048.08428,E,0.067,,221211,,,A*70
$GPRMC,125941.00,A,5120.06957,N,00048.08386,E,0.135,,221211,,,A*7C
$GPRMC,125942.00,A,5120.06952,N,00048.08369,E,0.123,,221211,,,A*7C
$GPRMC,125943.00,A,5120.06950,N,00048.08361,E,0.116,,221211,,,A*71
$GPRMC,125944.00,A,5120.06951,N,00048.08362,E,0.088,,221211,,,A*72
$GPRMC,125945.00,A,5120.06955,N,00048.08363,E,0.107,,221211,,,A*70
$GPRMC,125947.00,A,5120.06966,N,00048.08353,E,0.112,,221211,,,A*75
$GPRMC,125948.00,A,5120.06975,N,00048.08346,E,0.088,,221211,,,A*7E
$GPRMC,125950.00,A,5120.06983,N,00048.08331,E,0.085,,221211,,,A*73
$GPRMC,125952.00,A,5120.06994,N,00048.08326,E,0.271,,221211,,,A*78
$GPRMC,125953.00,A,5120.06998,N,00048.08328,E,0.121,,221211,,,A*7D
$GPRMC,125954.00,A,5120.06999,N,00048.08326,E,0.107,,221211,,,A*71
$GPRMC,125955.00,A,5120.07000,N,00048.08326,E,0.079,,221211,,,A*70
$GPRMC,125958.00,A,5120.07002,N,00048.08327,E,0.083,,221211,,,A*7B
$GPRMC,130002.00,A,5120.07017,N,00048.08332,E,0.086,,221211,,,A*7C
$GPRMC,130003.00,A,5120.07023,N,00048.08332,E,0.097,,221211,,,A*7A
$GPRMC,130005.00,A,5120.07020,N,00048.08333,E,0.086,,221211,,,A*7E
$GPRMC,130008.00,A,5120.07028,N,00048.08343,E,0.102,,221211,,,A*71
$GPRMC,130010.00,A,5120.07033,N,00048.08345,E,0.118,,221211,,,A*7F
$GPRMC,130012.00,A,5120.07039,N,00048.08338,E,0.082,,221211,,,A*7F
$GPRMC,130014.00,A,5120.07039,N,00048.08333,E,0.076,,221211,,,A*79
$GPRMC,130015.00,A,5120.07042,N,00048.08333,E,0.108,,221211,,,A*7C
$GPRMC,130016.00,A,5120.07043,N,00048.08333,E,0.100,,221211,,,A*76
$GPRMC,130018.00,A,5120.07049,N,00048.08336,E,0.088,,221211,,,A*76
$GPRMC,130019.00,A,5120.07051,N,00048.08340,E,0.129,,221211,,,A*75
$GPRMC,130021.00,A,5120.07054,N,00048.08349,E,0.060,,221211,,,A*7E
$GPRMC,130024.00,A,5120.07050,N,00048.08357,E,0.125,,221211,,,A*70
$GPRMC,130025.00,A,5120.07046,N,00048.08355,E,0.074,,221211,,,A*71
$GPRMC,130028.00,A,5120.07046,N,00048.08350,E,0.177,,221211,,,A*7B
$GPRMC,130029.00,A,5120.07049,N,00048.08350,E,0.133,,221211,,,A*75
$GPRMC,130031.00,A,5120.07048,N,00048.08351,E,0.123,,221211,,,A*7D
$GPRMC,130033.00,A,5120.07050,N,00048.08356,E,0.162,,221211,,,A*74
$GPRMC,130034.00,A,5120.07051,N,00048.08357,E,0.108,,221211,,,A*7F
$GPRMC,130035.00,A,5120.07050,N,00048.08359,E,0.124,,221211,,,A*7F
$GPRMC,130038.00,A,5120.07042,N,00048.08358,E,0.115,,221211,,,A*72
$GPRMC,130040.00,A,5120.07040,N,00048.08358,E,0.177,,221211,,,A*7B
$GPRMC,130043.00,A,5120.07032,N,00048.08355,E,0.117,,221211,,,A*76
$GPRMC,130044.00,A,5120.07027,N,00048.08355,E,0.155,,221211,,,A*73
$GPRMC,130047.00,A,5120.07021,N,00048.08354,E,0.145,,221211,,,A*76
$GPRMC,130049.00,A,5120.07013,N,00048.08355,E,0.276,,221211,,,A*7B
$GPRMC,130052.00,A,5120.07008,N,00048.08354,E,0.128,,221211,,,A*72
$GPRMC,130053.00,A,5120.07005,N,00048.08351,E,0.255,,221211,,,A*72
$GPRMC,130055.00,A,5120.07007,N,00048.08351,E,0.199,,221211,,,A*75
$GPRMC,130056.00,A,5120.07010,N,00048.08354,E,0.155,,221211,,,A*75
$GPRMC,130057.00,A,5120.07011,N,00048.08357,E,0.192,,221211,,,A*7D
$GPRMC,130059.00,A,5120.07019,N,00048.08358,E,0.187,,221211,,,A*70
$GPRMC,130100.00,A,5120.07026,N,00048.08359,E,0.131,,221211,,,A*7D
$GPRMC,130103.00,A,5120.07040,N,00048.08361,E,0.206,,221211,,,A*72
$GPRMC,130105.00,A,5120.07052,N,00048.08367,E,0.141,,221211,,,A*71
$GPRMC,130106.00,A,5120.07057,N,00048.08368,E,0.239,,221211,,,A*74
$GPRMC,130107.00,A,5120.07065,N,00048.08371,E,0.279,,221211,,,A*78
$GPRMC,130109.00,A,5120.07077,N,00048.08373,E,0.092,,221211,,,A*70
$GPRMC,130110.00,A,5120.07081,N,00048.08373,E,0.195,,221211,,,A*77
$GPRMC,130111.00,A,5120.07087,N,00048.08372,E,0.301,,221211,,,A*7E
$GPRMC,130114.00,A,5120.07116,N,00048.08368,E,0.179,,221211,,,A*74
$GPRMC,130116.00,A,5120.07131,N,00048.08363,E,0.292,,221211,,,A*7E
$GPRMC,130117.00,A,5120.07136,N,00048.08360,E,0.164,,221211,,,A*71
$GPRMC,130118.00,A,5120.07142,N,00048.08357,E,0.112,,221211,,,A*78
$GPRMC,130119.00,A,5120.07150,N,00048.08355,E,0.275,,221211,,,A*7A
$GPRMC,130120.00,A,5120.07156,N,00048.08352,E,0.355,,221211,,,A*72
$GPRMC,130121.00,A,5120.07164,N,00048.08351,E,0.263,,221211,,,A*75
$GPRMC,130122.00,A,5120.07171,N,00048.08350,E,0.132,,221211,,,A*74
$GPRMC,130125.00,A,5120.07187,N,00048.08350,E,0.302,,221211,,,A*7B
$GPRMC,130127.00,A,5120.07198,N,00048.08354,E,0.122,,221211,,,A*73
$GPRMC,130128.00,A,5120.07199,N,00048.08354,E,0.220,,221211,,,A*7C
$GPRMC,130129.00,A,5120.07204,N,00048.08356,E,0.309,,221211,,,A*72
$GPRMC,130130.00,A,5120.07210,N,00048.08356,E,0.168,,221211,,,A*7A
$GPRMC,130134.00,A,5120.07211,N,00048.08362,E,0.258,,221211,,,A*78
$GPRMC,130135.00,A,5120.07214,N,00048.08364,E,0.137,,221211,,,A*70
$GPRMC,130136.00,A,5120.07213,N,00048.08365,E,0.087,,221211,,,A*7F
$GPRMC,130138.00,A,5120.07213,N,00048.08361,E,0.245,,221211,,,A*79
$GPRMC,130139.00,A,5120.07216,N,00048.08358,E,0.168,,221211,,,A*7B
$GPRMC,130144.00,A,5120.07228,N,00048.08333,E,0.209,,221211,,,A*75
$GPRMC,130145.00,A,5120.07228,N,00048.08326,E,0.337,,221211,,,A*7C
$GPRMC,130146.00,A,5120.07231,N,00048.08323,E,0.481,,221211,,,A*78
$GPRMC,130147.00,A,5120.07234,N,00048.08320,E,0.376,,221211,,,A*70
$GPRMC,130148.00,A,5120.07239,N,00048.08315,E,0.269,,221211,,,A*7B
$GPRMC,130149.00,A,5120.07240,N,00048.08310,E,0.263,,221211,,,A*7B
$GPRMC,130150.00,A,5120.07242,N,00048.08304,E,0.425,,221211,,,A*70
$GPRMC,130152.00,A,5120.07239,N,00048.08305,E,0.175,,221211,,,A*7F
$GPRMC,130153.00,A,5120.07238,N,00048.08303,E,0.147,,221211,,,A*78
$GPRMC,130154.00,A,5120.07238,N,00048.08301,E,0.362,,221211,,,A*78
$GPRMC,130155.00,A,5120.07239,N,00048.08296,E,0.392,,221211,,,A*78
$GPRMC,130156.00,A,5120.07236,N,00048.08292,E,0.225,,221211,,,A*7D
$GPRMC,130159.00,A,5120.07228,N,00048.08281,E,0.389,,221211,,,A*78
$GPRMC,130200.00,A,5120.07228,N,00048.08280,E,0.291,,221211,,,A*7E
$GPRMC,130204.00,A,5120.07207,N,00048.08274,E,0.238,,221211,,,A*7F
$GPRMC,130206.00,A,5120.07192,N,00048.08278,E,0.035,,221211,,,A*71
$GPRMC,130207.00,A,5120.07183,N,00048.08279,E,0.143,,221211,,,A*71
$GPRMC,130208.00,A,5120.07176,N,00048.08279,E,0.234,,221211,,,A*77
$GPRMC,130211.00,A,5120.07166,N,00048.08284,E,0.162,,221211,,,A*7C
$GPRMC,130212.00,A,5120.07160,N,00048.08282,E,0.307,,221211,,,A*7E
$GPRMC,130214.00,A,5120.07153,N,00048.08285,E,0.153,,221211,,,A*7C
$GPRMC,130215.00,A,5120.07153,N,00048.08283,E,0.156,,221211,,,A*7E
$GPRMC,130216.00,A,5120.07151,N,00048.08284,E,0.247,,221211,,,A*7B
$GPRMC,130217.00,A,5120.07149,N,00048.08284,E,0.316,,221211,,,A*76
$GPRMC,130218.00,A,5120.07149,N,00048.08288,E,0.216,,221211,,,A*74
$GPRMC,130220.00,A,5120.07148,N,00048.08296,E,0.231,,221211,,,A*74
$GPRMC,130222.00,A,5120.07144,N,00048.08306,E,0.233,,221211,,,A*70
$GPRMC,130223.00,A,5120.07144,N,00048.08310,E,0.158,,221211,,,A*78
$GPRMC,130225.00,A,5120.07131,N,00048.08319,E,0.243,,221211,,,A*7C
$GPRMC,130226.00,A,5120.07128,N,00048.08323,E,0.237,,221211,,,A*7D
$GPRMC,130227.00,A,5120.07124,N,00048.08328,E,0.125,,221211,,,A*7B
$GPRMC,130228.00,A,5120.07121,N,00048.08334,E,0.111,,221211,,,A*7B
$GPRMC,130229.00,A,5120.07116,N,00048.08338,E,0.215,,221211,,,A*75
$GPRMC,130232.00,A,5120.07108,N,00048.08353,E,0.117,,221211,,,A*7C
$GPRMC,130233.00,A,5120.07104,N,00048.08359,E,0.171,,221211,,,A*7B
$GPRMC,130234.00,A,5120.07103,N,00048.08362,E,0.359,,221211,,,A*7B
$GPRMC,130235.00,A,5120.07104,N,00048.08366,E,0.277,,221211,,,A*74
$GPRMC,130236.00,A,5120.07107,N,00048.08372,E,0.161,,221211,,,A*75
$GPRMC,130237.00,A,5120.07109,N,00048.08377,E,0.170,,221211,,,A*7F
$GPRMC,130244.00,A,5120.07090,N,00048.08404,E,0.186,,221211,,,A*70
$GPRMC,130245.00,A,5120.07092,N,00048.08409,E,0.143,,221211,,,A*77
$GPRMC,130247.00,A,5120.07083,N,00048.08409,E,0.291,,221211,,,A*79
$GPRMC,130250.00,A,5120.07078,N,00048.08419,E,0.132,,221211,,,A*70
$GPRMC,130253.00,A,5120.07073,N,00048.08421,E,0.118,,221211,,,A*7B
$GPRMC,130254.00,A,5120.07069,N,00048.08416,E,0.128,,221211,,,A*70
$GPRMC,130255.00,A,5120.07064,N,00048.08413,E,0.271,,221211,,,A*76
$GPRMC,130256.00,A,5120.07060,N,00048.08409,E,0.271,,221211,,,A*7A
$GPRMC,130258.00,A,5120.07056,N,00048.08402,E,0.096,,221211,,,A*71
$GPRMC,130300.00,A,5120.07053,N,00048.08394,E,0.276,,221211,,,A*7C
$GPRMC,130301.00,A,5120.07052,N,00048.08390,E,0.215,,221211,,,A*7D
$GPRMC,130302.00,A,5120.07054,N,00048.08386,E,0.158,,221211,,,A*75
$GPRMC,130304.00,A,5120.07052,N,00048.08376,E,0.253,,221211,,,A*72
$GPRMC,130305.00,A,5120.07055,N,00048.08373,E,0.379,,221211,,,A*78
$GPRMC,130309.00,A,5120.07055,N,00048.08372,E,0.273,,221211,,,A*7E
$GPRMC,130310.00,A,5120.07053,N,00048.08374,E,0.251,,221211,,,A*76
$GPRMC,130312.00,A,5120.07050,N,00048.08377,E,0.166,,221211,,,A*73
$GPRMC,130314.00,A,5120.07048,N,00048.08380,E,0.302,,221211,,,A*74
$GPRMC,130317.00,A,5120.07050,N,00048.08387,E,0.225,,221211,,,A*7D
$GPRMC,130318.00,A,5120.07049,N,00048.08389,E,0.344,,221211,,,A*72
$GPRMC,130320.00,A,5120.07046,N,00048.08395,E,0.165,,221211,,,A*7A
$GPRMC,130321.00,A,5120.07041,N,00048.08394,E,0.194,,221211,,,A*73
$GPRMC,130323.00,A,5120.07035,N,00048.08397,E,0.203,,221211,,,A*7C
$GPRMC,130324.00,A,5120.07031,N,00048.08398,E,0.142,,221211,,,A*76
$GPRMC,130326.00,A,5120.07021,N,00048.08398,E,0.241,,221211,,,A*75
$GPRMC,130327.00,A,5120.07018,N,00048.08400,E,0.218,,221211,,,A*74
$GPRMC,130328.00,A,5120.07018,N,00048.08403,E,0.156,,221211,,,A*71
$GPRMC,130329.00,A,5120.07021,N,00048.08404,E,0.176,,221211,,,A*7F
$GPRMC,130332.00,A,5120.07031,N,00048.08414,E,0.199,,221211,,,A*74
$GPRMC,130333.00,A,5120.07031,N,00048.08417,E,0.129,,221211,,,A*7D
$GPRMC,130334.00,A,5120.07032,N,00048.08419,E,0.203,,221211,,,A*7C
$GPRMC,130335.00,A,5120.07032,N,00048.08419,E,0.264,,221211,,,A*7C
$GPRMC,130336.00,A,5120.07032,N,00048.08421,E,0.248,,221211,,,A*7A
$GPRMC,130337.00,A,5120.07037,N,00048.08421,E,0.185,,221211,,,A*7C
$GPRMC,130338.00,A,5120.07039,N,00048.08421,E,0.139,,221211,,,A*7A
$GPRMC,130339.00,A,5120.07040,N,00048.08420,E,0.216,,221211,,,A*7A
$GPRMC,130340.00,A,5120.07043,N,00048.08419,E,0.309,,221211,,,A*72
$GPRMC,130341.00,A,5120.07045,N,00048.08419,E,0.220,,221211,,,A*7F
$GPRMC,130342.00,A,5120.07048,N,00048.08416,E,0.160,,221211,,,A*79
$GPRMC,130344.00,A,5120.07054,N,00048.08412,E,0.324,,221211,,,A*74
$GPRMC,130345.00,A,5120.07060,N,00048.08410,E,0.266,,221211,,,A*77
$GPRMC,130347.00,A,5120.07074,N,00048.08412,E,0.301,,221211,,,A*72
$GPRMC,130348.00,A,5120.07091,N,00048.08420,E,0.610,,221211,,,A*72
$GPRMC,130351.00,A,5120.07112,N,00048.08424,E,0.304,,221211,,,A*74
$GPRMC,130353.00,A,5120.07125,N,00048.08424,E,0.374,,221211,,,A*75
$GPRMC,130355.00,A,5120.07137,N,00048.08427,E,0.183,,221211,,,A*79
$GPRMC,130356.00,A,5120.07140,N,00048.08428,E,0.211,,221211,,,A*7D
$GPRMC,130358.00,A,5120.07144,N,00048.08430,E,0.283,,221211,,,A*75
$GPRMC,130401.00,A,5120.07154,N,00048.08437,E,0.202,,221211,,,A*71
$GPRMC,130405.00,A,5120.07164,N,00048.08442,E,0.213,,221211,,,A*74
$GPRMC,130406.00,A,5120.07165,N,00048.08439,E,0.317,,221211,,,A*7F
$GPRMC,130407.00,A,5120.07166,N,00048.08438,E,0.240,,221211,,,A*7F
$GPRMC,130412.00,A,5120.07153,N,00048.08416,E,0.180,,221211,,,A*7E
$GPRMC,130414.00,A,5120.07142,N,00048.08414,E,0.241,,221211,,,A*74
$GPRMC,130416.00,A,5120.07140,N,00048.08414,E,0.294,,221211,,,A*7C
$GPRMC,130419.00,A,5120.07122,N,00048.08399,E,0.360,,221211,,,A*7F
$GPRMC,130420.00,A,5120.07108,N,00048.08393,E,0.204,,221211,,,A*74
$GPRMC,130422.00,A,5120.07089,N,00048.08383,E,0.156,,221211,,,A*7B
$GPRMC,130424.00,A,5120.07080,N,00048.08369,E,0.263,,221211,,,A*75
$GPRMC,130426.00,A,5120.07074,N,00048.08358,E,0.186,,221211,,,A*76
$GPRMC,130428.00,A,5120.07077,N,00048.08356,E,0.413,,221211,,,A*7C
$GPRMC,130429.00,A,5120.07083,N,00048.08355,E,0.297,,221211,,,A*7F
$GPRMC,130430.00,A,5120.07083,N,00048.08351,E,0.195,,221211,,,A*72
$GPRMC,130431.00,A,5120.07080,N,00048.08349,E,0.202,,221211,,,A*74
$GPRMC,130432.00,A,5120.07084,N,00048.08347,E,0.261,,221211,,,A*78
$GPRMC,130435.00,A,5120.07095,N,00048.08352,E,0.234,,221211,,,A*7B
$GPRMC,130436.00,A,5120.07091,N,00048.08354,E,0.245,,221211,,,A*7C
$GPRMC,130438.00,A,5120.07095,N,00048.08358,E,0.236,,221211,,,A*7E
$GPRMC,130440.00,A,5120.07094,N,00048.08357,E,0.297,,221211,,,A*74
$GPRMC,130442.00,A,5120.07091,N,00048.08361,E,0.255,,221211,,,A*78
$GPRMC,130443.00,A,5120.07090,N,00048.08362,E,0.194,,221211,,,A*75
$GPRMC,130445.00,A,5120.07092,N,00048.08365,E,0.392,,221211,,,A*72
$GPRMC,130446.00,A,5120.07092,N,00048.08365,E,0.296,,221211,,,A*74
$GPRMC,130447.00,A,5120.07095,N,00048.08365,E,0.246,,221211,,,A*7F
$GPRMC,130448.00,A,5120.07097,N,00048.08366,E,0.310,,221211,,,A*73
$GPRMC,130452.00,A,5120.07120,N,00048.08369,E,0.265,,221211,,,A*79
$GPRMC,130454.00,A,5120.07130,N,00048.08372,E,0.368,,221211,,,A*78
$GPRMC,130455.00,A,5120.07138,N,00048.08372,E,0.316,,221211,,,A*78
$GPRMC,130457.00,A,5120.07159,N,00048.08372,E,0.336,,221211,,,A*7F
$GPRMC,130458.00,A,5120.07170,N,00048.08371,E,0.412,,221211,,,A*79
$GPRMC,130459.00,A,5120.07175,N,00048.08371,E,0.336,,221211,,,A*7C
$GPRMC,130500.00,A,5120.07179,N,00048.08371,E,0.295,,221211,,,A*75
$GPRMC,130501.00,A,5120.07182,N,00048.08371,E,0.267,,221211,,,A*7D
$GPRMC,130502.00,A,5120.07183,N,00048.08369,E,0.298,,221211,,,A*76
$GPRMC,130503.00,A,5120.07183,N,00048.08369,E,0.297,,221211,,,A*78
$GPRMC,130505.00,A,5120.07190,N,00048.08361,E,0.219,,221211,,,A*72
$GPRMC,130507.00,A,5120.07192,N,00048.08354,E,0.320,,221211,,,A*7F
$GPRMC,130508.00,A,5120.07192,N,00048.08351,E,0.272,,221211,,,A*73
$GPRMC,130510.00,A,5120.07196,N,00048.08345,E,0.303,,221211,,,A*7C
$GPRMC,130511.00,A,5120.07197,N,00048.08344,E,0.343,,221211,,,A*79
$GPRMC,130513.00,A,5120.07199,N,00048.08339,E,0.227,,221211,,,A*7C
$GPRMC,130515.00,A,5120.07202,N,00048.08330,E,0.396,,221211,,,A*79
$GPRMC,130518.00,A,5120.07221,N,00048.08319,E,0.290,,221211,,,A*79
$GPRMC,130519.002
hope this helps
ken b