gpsdev
Add-On Required: This feature requires the MATLAB Support Package for Arduino Hardware add-on.
Description
The gpsdev
object reads position and time data using a Global Positioning
System(GPS) module. The gpsdev
object represents a connection to the GPS
receiver connected to the serial port of the Arduino® hardware. gpsdev
uses GPRMC, GPGGA and GPGSA sentences to
read the data. The GPS receiver must output these sentences for successful creation of the
gpsdev
object. Ensure your GPS module is configured to give the
sentences.
Creation
Description
creates a GPS object. The object represents the connection to the GPS on the Arduino hardware, gpsObj
= gpsdev(a
)a
.
sets properties using one or more name-value pairs.gpsObj
= gpsdev(___,Name,Value
)
Input Arguments
Properties
Usage
Create GPS Connection
Create an Arduino object and include the Serial library.
a = arduino('COM4', 'Mega2560', 'Libraries', 'Serial');
Create the GPS object.
gpsObj = gpsdev(a)
gpsObj = gpsdev with properties: SerialPort: 1 BaudRate: 9600 (bits/s) SamplesPerRead: 2 ReadMode: 'oldest' SamplesRead: 0 SamplesAvailable: 0 Show all properties, functions
Create GPS Connection with Additional Name-Value Pair Arguments
Create a GPS object with additional properties specified as name-value pair arguments.
gpsObj = gpsdev(a,'SamplesPerRead',3,'ReadMode','latest')
gpsObj = gpsdev with properties: SerialPort: 1 BaudRate: 9600 (bits/s) SamplesPerRead: 3 ReadMode: 'latest' SamplesRead: 0 SamplesAvailable: 0
Object Functions
More About
Version History
Introduced in R2020a