hi!
i new arduino programming please forgive me if question stupid. trying store gps altitude data along data ultrasonic sensor. can program sensor without issue didn't include code. problem outputs 0 : 0.00 : 0 when should 0 : 180.7 : 57. have seconds in there because need have real time clock well. deleted bunch of gps things example didn't think necessary in order fit under memory limit of uno.
code:
i new arduino programming please forgive me if question stupid. trying store gps altitude data along data ultrasonic sensor. can program sensor without issue didn't include code. problem outputs 0 : 0.00 : 0 when should 0 : 180.7 : 57. have seconds in there because need have real time clock well. deleted bunch of gps things example didn't think necessary in order fit under memory limit of uno.
code:
quote
#include <spi.h>any appreciated!
#include <sd.h>
#include <adafruit_gps.h>
#include <softwareserial.h>
#include <newping.h>
softwareserial myserial(8, 7);
adafruit_gps gps(&myserial);
#define gpsecho true
#define trigger_pin 12
#define echo_pin 11
#define max_distance 200
int total;
int pin;
newping sonar(trigger_pin, echo_pin, max_distance);
const int chipselect = 10;
void setup()
{
serial.begin(115200);
serial.println("adafruit gps library basic test!");
gps.begin(9600);
gps.sendcommand(pmtk_set_nmea_output_rmcgga);
gps.sendcommand(pmtk_set_nmea_update_1hz); // 1 hz update rate
gps.sendcommand(pgcmd_antenna);
pinmode(10, output);
sd.begin(chipselect);
delay(1000);
myserial.println(pmtk_q_release);
}
signal(timer0_compa_vect) {
char c = gps.read();
}
void loop()
{
char c = gps.read();
file datafile = sd.open("datalog.txt", file_write);
datafile.print(total);
datafile.print(" : ");
datafile.print(gps.altitude);
datafile.print(" : ");
datafile.println(gps.seconds, dec);
/*datafile.print(now.hour());
datafile.print(".");
datafile.print(now.minute());
datafile.print(".");
datafile.println(now.second());*/
datafile.close();
}
quote
i deleted bunch of gps things example didn't think necessary in order fit under memory limit of uno.but, still reading data in loop() , in isr... stop doing 1 of them. (probably isr).
you'll need post link adafruit_gps library.
you need put stuff deleted, too. thought not necessary is.
the way reading data wrong.
Arduino Forum > Using Arduino > Programming Questions > GPS datalogging problem.
arduino
Comments
Post a Comment