new GPS( io )

Description
The GPS class allows communication with GPS receivers
Parameters
Name Type Description
io Array.<number> | Array.<string> | object The pin numbers, pin identifiers or a complete IO options object
Name Type Attributes Default Description
baud number <optional>
9600 The baud rate for serial communication
pins Array.<number> | Array.<string> <optional>
If passing an object, the pin numbers or pin identifiers for transmit and receive in a 2 element array
transmit number | string <optional>
The pin number or pin identifier for transmit
receive number | string <optional>
The pin number or pin identifier for receive
port number | string <optional>
0 The serial port number or port identifier
Fires
Details

Emitter

Members


<readonly> latitude :number

Description
The most recent measured latitude
Details
number

<readonly> longitude :number

Description
The most recent measured longitude
Details
number

<readonly> altitude :number

Description
The most recent measured altitude
Details
number

<readonly> sat :object

Description
Satellite operation details {pdop, hdop, vdop}
Details
object

<readonly> speed :number

Description
The most recent measured ground speed
Details
number

<readonly> course :number

Description
The most recent measured course
Details
number

<readonly> time :number

Description
Time of last fix
Details
number

frequency :number

Description
Frequency of updates in hz
Details
number

Methods


config( [ options ] ) → {GPS}

Description
Configure a GPS
Parameters
Name Type Attributes Default Description
options object <optional>
{} An object containing device options
Name Type Attributes Default Description
frequency number <optional>
1 The frequency of updates in Hz
fixed number <optional>
6 Precision for latitude and longitude readings
Returns
The instance on which the method was called
Examples
import GPS from "j5e/gps";
			
			const gps = await new GPS({
			  transmit: 17,
			  receive: 16,
			  port: 2,
			  baud: 9600
			});
			
			gps.configure({
			  frequency: 2
			});
Details