Ultimate GPS Logger Shield with Garmin Sonar Readings
hello everybody,
i'm having troubles "ultimate gps datalogger" adafruit. have garmin sonar connected "ultimate gps datalogger" , arduino uno. garmin sonar sends strings information depth, read strings datalogger. shield able read/write both gps position , string.
however, problem after couple of readings stops. after 10 readings, after 3 readings. during last reading, shield logs first reading sonar , stops @ moment when should read gps signal. surprises me if reset datalogger, without problem starts logging again, , stops after seemingly random number of strings. however, when try log gps signal, code, there no problem.
anyone encountered similar problem adafruit ultimate gps datalogger? can arduino uno hasn't sufficient capacity run code? in case has experience logging string coming out sonar, advice highly appreciated.
thanks beforehand,
esteban caligaris,
asuncion, paraguay
p.d.: code i'm using:
i'm having troubles "ultimate gps datalogger" adafruit. have garmin sonar connected "ultimate gps datalogger" , arduino uno. garmin sonar sends strings information depth, read strings datalogger. shield able read/write both gps position , string.
however, problem after couple of readings stops. after 10 readings, after 3 readings. during last reading, shield logs first reading sonar , stops @ moment when should read gps signal. surprises me if reset datalogger, without problem starts logging again, , stops after seemingly random number of strings. however, when try log gps signal, code, there no problem.
anyone encountered similar problem adafruit ultimate gps datalogger? can arduino uno hasn't sufficient capacity run code? in case has experience logging string coming out sonar, advice highly appreciated.
thanks beforehand,
esteban caligaris,
asuncion, paraguay
p.d.: code i'm using:
code: [select]
#include <softwareserial.h>
#include <spi.h>
#include <sd.h>
softwareserial sonar(6,5); // rx, tx
softwareserial gps(8,7);
#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"
string inputstring1 = "";
string inputstring2 = ""; // string hold incoming data
const int chipselect = 10;
file datafile;
boolean stringcomplete = false; // whether string complete
int a=0;
void setup()
{
//serial.begin(57600); // xbee
serial.begin(115200); // terminal
sonar.begin(4800);
gps.begin(9600);
inputstring1.reserve(200);
inputstring2.reserve(200);
gps.println(pmtk_set_nmea_output_rmconly);
serial.print("initializing sd card...");
// make sure default chip select pin set to
// output, if don't use it:
pinmode(ss, output);
// see if card present , can initialized:
if (!sd.begin(chipselect)) {
serial.println("card failed, or not present");
// don't more:
while (1) ;
}
serial.println("card initialized.");
// open file we're going log to!
datafile = sd.open("datalog.txt", file_write);
if (! datafile) {
serial.println("error opening datalog.txt");
// wait forever since cant write data
while (1) ;
}
}
void loop() {
sonar.listen();
while(a==0){
while (sonar.available()) {
char inchar = (char)sonar.read();
inputstring1 += inchar;
if (inchar == '\n') {
stringcomplete = true;
}
}
if (stringcomplete) {
if (inputstring1.startswith("$sddbt")){
a=1;
datafile.println(inputstring1);
serial.print(inputstring1);
datafile.flush();
}
inputstring1 = "";
stringcomplete = false;
}
}
gps.listen();
while(a==1){
while (gps.available()) {
char inchar = (char)gps.read();
inputstring2 += inchar;
if (inchar == '\r') {
stringcomplete = true;
}
}
if (stringcomplete) {
if (inputstring2.startswith("$gprmc")){
datafile.println(inputstring2);
serial.print(inputstring2);
datafile.flush();
a=0;
}
inputstring2 = "";
stringcomplete = false;
}
}
}
i'd "get rid of strings".
but then, don't strings, , never use them.
but then, don't strings, , never use them.
Arduino Forum > Using Arduino > Project Guidance > Ultimate GPS Logger Shield with Garmin Sonar Readings
arduino
Comments
Post a Comment