• part 5 of 5 of: GPS Module, Extensions, and u-blox NEO-6M GPS receiver

    PS: If you want to see the raw data in the console all the times, add a line handler and callback tuple with an alway false returning line handler as last to the handlers. This will get you all lines send by the GPS receiver printed in the console.

    var handlers3 =
    [ [ null // re-using GPS module's ggaHandler...
      , callback2 // ...w/ callback2
      ]
    , [ function(line,callback) { // rmcHandler
          var tag = line.substr(3,3);
          if (tag=="RMC") {
            var d = line.split(",");
            callback(
              { timc: d[1].substr(0,6)
              , latc: (parseInt(d[3].substr(0,2),10) + parseFloat(d[3].substr(2))/60) * (d[4]=="S"?-1:1)
              , lonc: (parseInt(d[5].substr(0,3),10) + parseFloat(d[5].substr(3))/60) * (d[4]=="W"?-1:1)
              , velc: parseFloat(d[7])
              , angl: d[8]
              , datc: d[9]
              });
            return true;
          } else {
            return false;
          }
         }
      , callback
      ]
    , [ function(line,callback) { callback(line); return false; }
      , function(data) { console.log("raw > ",data); }
      ]
    ];
    

    Output in the console:

    cbk2 > {```

    "lat": 41.2242, "lon": -102.87471116666, "fix": 2, "satellites": 9, "altitude": 92.4 }```

    raw > $GPGSV,3,1,10,02,31,052,15,05,53,089,37,10,15,042,21,12,42,164,33*79```

    raw > $GPGSV,3,3,10,46,38,145,,51,44,156,38*7C```

    raw > $GPRMC,131934.00,A,4113.45229,N,10252.48332,W,1.188,204.02,300914,,,D*7A```

    "timc": "131934",```

    "angl": "204.02",```

    }
    raw > $GPVTG,204.02,T,,M,1.188,N,2.199,K,D*3F

    End of 5 parts series: GPS Module, Extensions, and u-blox NEO-6M GPS receiver

About

Avatar for allObjects @allObjects started