NewSoftSerial storing a NMEA string


well here goes.
i'm in process of piecing rocket flight computer (overall coming along nicely, have site posted shortly), , stuck on last bit of code system operational.
basically, have been doing reading standard gps (nmea) using newsoftserial on pins 2,3, printing serial output that.  this looks so:
quote
while (gps.available()) {
   serial.print((char)gps.read());
 }

that works nicely in serial monitor , jazz, go no problem.  i figured going loading entire nmea string gps.read() command , passing on.
what i'm trying save gps data sd card well, using sdfat library.  (using arduino pro mini, plenty of sketch size left)
i tried have gps.read() go char variable @ first, realized gps.read() spit out small little chunk of data, didnt notice because saw of data spit out serial.
so made gps.read() spit out array.  this worked more or less ok, , able output data on card, serial, although serial turned garbage data nmea strand , sd card data file had nmea strings broken 2 so:
quote

$gpgga,135401.242,,,,,0,00,,,m,0.0,m,,0000*50
$gpgs?,a,y,,,,,,3,1,
$gpgga,135401.242,,,,,0,00,,,m,0.0,m,,0000*50
$gpgs$.a,.,,v,,,3,1,
$gpgga,135402.248,,,,,0,00,,,m,0.0,m,,0000*59
$gpgs,a,p,,,f,,,,21,
0610,,*24
02.248,,,,,0,00,,,m,0.0,m,,0000*59
$gpgs.a,.,,a,,,,21,
$gpgga,135403.240,,,,,0,00,,,m,0.0,m,,0000*50
$gpgsÒ,a,Å,,,e,,$gpr,
mc,135403.240,v,,,,,,,210610,,*2d
m,,0000*50
$gpgs.a,.,,+,,$gpr,
$gpgga,135404.243,,,,,0,0010,,*2d
m,,0000*50
$gpgs?/a,?/,,a,,$gpr,
,,,m,0.0,m,,0000*54
$gpgsa,a,1,,,,,,,,,,,,,,,*1e
$}pgs,3,s,1,*74,

(there no gps lock, underneath metal roof)
from can tell this, array created being written, incorporating multiple nmea sentences inside of it.  this corrupting regular data output program appear.  

so, question, there nice little compact code reading & storing nmea sentance newsoftserial allows me manipulate (send serial , sd) values? im guessing  probably string array?
i would/will post newer version of code, i'm still working on recreating after power loss...
thanks help, , feel free ask me questions have.
~dan

the data coming software serial port gps. recognize when end of packet has been received. typically, packet ends cr or lf. need recognize character cr (or lf). if is, write out accumulated string, , re-initialize string.

or, use tinygps library, manages end of packet handling you.


Arduino Forum > Forum 2005-2010 (read only) > Software > Syntax & Programs > NewSoftSerial storing a NMEA string


arduino

Comments

Popular posts from this blog

CAN'T INSTALL MAMBELFISH 1.5 FROM DIRECTORY - Joomla! Forum - community, help and support

error: expected initializer before 'void'

CPU load monitoring using GPIO and leds - Raspberry Pi Forums