Skip to content

mennamorato/gps-a2235h

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#GPS Driver for the gps-a2235h Tessel GPS module. The hardware documentation for this module can be found here.

If you run into any issues you can ask for support on the GPS Module Forums.

###Installation

npm install gps-a2235h

###Example

/**********************************************************
This gps example logs a stream of data:
coordinates, detected satellites, timestamps, and altitude.
For best results, try it while outdoors.
**********************************************************/

var tessel = require('tessel');
var gpsLib = require('gps-a2235h');

var gps = gpsLib.use(tessel.port['A']);

var satsInRange = 0;
var satsFixed = 0;

// Wait until the module is connected
gps.on('ready', function () {
  console.log('GPS module powered and ready. Waiting for satellites...');
  // Emit coordinates when we get a coordinate fix
  gps.on('coordinates', function (coords) {
    console.log('Lat:', coords.lat, '\tLon:', coords.lon, '\tTimestamp:', coords.timestamp);
  });

  // Emit altitude when we get an altitude fix
  gps.on('altitude', function (alt) {
    console.log('Got an altitude of', alt.alt, 'meters (timestamp: ' + alt.timestamp + ')');
  });

  // Emitted whenever satellites are in view
  gps.on('satellite-list-partial', function (data) {
    satsInRange = data.satsInView;
    console.log(satsInRange, 'satellites in range,', satsFixed, 'fixed.');
  });

  // Emitted when we have information about a fix on satellites
  gps.on('fix', function (data) {
    satsFixed = data.numSat;
    console.log(satsInRange, 'satellites in range,', satsFixed, 'fixed.');
  });
});

###Methods # gps.powerOff( callback() ) Turns the GPS chip off.

# gps.powerOn( callback() ) Turns the GPS chip on.

# gps.setCoordinateFormat( format, callback() ) Configure how the module reports latitude and longitude: options are 'deg-min-sec', 'deg-min-dec', and 'deg-dec'.

###Events # gps.on( 'altitude', callback(altitudeObj) ) Emitted when altitude data is available. Emitted in the form {altitude in meters, timestamp}.

# gps.on( 'coordinates', callback(coordinateObj) ) Emitted when coordinate data is available. Emitted in the form {latitude, longitude, timestamp}.

# gps.on( 'error', callback(err) ) Emitted upon error.

# gps.on( 'powerOff', callback() ) Emitted when the module has been powered off.

# gps.on( 'powerOn', callback() ) Emitted when the module has been powered on.

# gps.on( 'ready', callback() ) Emitted upon first successful communication between the Tessel and the module.

####Also emits parsed NMEA objects by type: # gps.on( 'active-satellites', callback(data) ) NMEA GPGSA: GPS DOP and active satellites.

# gps.on( 'fix', callback(data) ) NMEA GPGGA: Global positioning system fix data.

# gps.on( 'nav-info', callback(data) ) NMEA GPRMC: Recommended minimum specific GPS/Transit data.

# gps.on( 'satellite-list-partial', callback(data) ) NMEA GPGSV: GPS satellites in view.

# gps.on( 'track-info', callback(data) ) NMEA GPVTG: Track made good and ground speed.

###Further Examples

  • GPS Options. This gps example logs a stream of data: coordinates, detected satellites, timestamps, and altitude.

###License MIT or Apache 2.0, at your option

About

Driver for the Tessel GPS module

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published