arduino - GPS altitude print to LCD -
i trying arduino uno display altitude gps module, without other data. still learning code, i've run problem can't seem find command used pull altitude gps string. know pulling data successfully, ran example code http://learn.parallax.com/kickstart/28500 , read first bit of string, though moved onto trying altitude before getting scroll whole string. using basic 16x2 lcd display, , display have working fine.
the end goal of project gps/gyroscope altimeter can record sd card , record temperature, , deploy parachute @ apogee (15,000ft) , larger parachute @ 1,000ft.
here code using altitude, i've marked section can't figure out. (probably missing term, or might have messed up)
any appreciated, have great day.
#include <softwareserial.h> #include "./tinygps.h" // special version 1.0 #include <liquidcrystal.h> tinygps gps; softwareserial nss(0, 255); // yellow wire pin 6 liquidcrystal lcd(7, 8, 9, 10, 11, 12); void gpsdump(tinygps &gps); bool feedgps(); void setup() { // set lcd's number of columns , rows: lcd.begin(16, 2); // initialize serial communications: serial.begin(9600); serial.begin(115200); nss.begin(4800); lcd.print("reading gps"); lcd.write(254); // move cursor beginning of first line lcd.write(128); lcd.write(" "); // clear display lcd.write(" "); } void loop() { bool newdata = false; unsigned long start = millis(); while (millis() - start < 5000) { // update every 5 seconds if (feedgps()) newdata = true; } gpsdump(gps); } // , process gps data void gpsdump(tinygps &gps) { // problem area float falt, flat, flon; unsigned long age; gps.f_get_position(&flat, &flon); inline long altitude (return _altitude); long _altitude ;lcd.print(_altitude, 4); }//end problem area // feed data becomes available bool feedgps() { while (nss.available()) { if (gps.encode(nss.read())) return true; } return false; }
lcd.print(x,4) prints base-4. did want that, or want ordinary base-10 (decimal)?
secondly, expect _altitude come from? it's uninitialized. there's uninitialized falt, , weird inline long altitude line doesn't mean anything.
you might better of learning c++ first, in desktop environment. debugging embedded device lot harder, , you're still producing quite few bugs.
Comments
Post a Comment