Hi, for a bit of context im designing a GPS, datalogger and simple roll stabilisation for a UAV. I don't really know etiquette for posting here so just let me know if its too much. My problem comes from the GPS saying that it isn't receiving a GPS fix when really i think it should. Im using the NEOGPS library and the GPS itself works perfectly within all the examples, similarly for each of the functions I need to code, they work, the problem comes when combining them together.
The sensors i'm using are: Gyro, accel+magnometer, pressure sensor, GPS.
The data im trying to gather: roll, pitch, date, time, lat, long, alt, speed, heading.
On an arduino Mega with adafruit ultimate GPS logging Shield.
the Gyro, accel, pressure and SD logging work perfectly in their sketch.
the GPS and SD logging work perfectly in their own sketch.
When i simply tried to directly copy paste them over everything went wrong as it normally does. So i built the sketch up line by line until i found the problem. I can have GPS, gyro and accel with datalogging working more or less as intended. But only just. as soon as i add even a 100ms delay, the GPS stops satisfying its if(gps.available(gpsport)){} criteria and i get no GPS data to log.
The same thing happens if i try to add pressure(altitude) sensing or Heading into the mix. I considered that perhaps the GPS buffer was too full and that slowing down the code any further was causing it to overflow and lose data. But i find this unlikely as i log roll and pitch ~20 times for every one log containing GPS data.
The code is below but its almost 400 lines long so i don't expect anyone to read it line by line! id just like to see of anyone knows why adding a small delay or additional sensor could break the gps of an otherwise reasonably functional piece of code.
if you would rather i post it directly i can do that too.
this version of the code uses all the functions that work, but even adding something like a delay(100); makes the GPS data stop being spat out, either into serial or SD despite compiling.
Again, this is a rather broad question so i understand if you guys can't advise much.
I'd appreciate any help.