Created
November 11, 2017 22:44
-
-
Save esmarr58/ce18e23a3125bbc2b5bcae4f122bcdac to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
clc | |
clear all | |
serialPort = 'COM27'; | |
serialObject = serial(serialPort); | |
set(serialObject, 'BaudRate',9600); | |
fopen(serialObject); | |
pause(1); | |
size=serialObject.BytesAvailable | |
condicion =1; | |
while condicion == 1 | |
A = fscanf(serialObject, '%c', 1); | |
if A=='$' | |
NMEA =fscanf(serialObject, '%c', 5) | |
if NMEA == 'GPGGA' | |
TEMP = fscanf(serialObject, '%c', 11); | |
LATITUD_NORTE=fscanf(serialObject, '%c', 12) | |
TEMP = fscanf(serialObject, '%c', 1); | |
LONGITUD_OESTE=fscanf(serialObject, '%c', 13) | |
TEMP = fscanf(serialObject, '%c', 11); | |
ALTURA=fscanf(serialObject, '%c', 8) | |
condicion=0; | |
end | |
end | |
if(A<1) | |
A = 1; | |
end | |
end | |
%fprintf(serialObject, '%c','v'); | |
fclose(serialObject); | |
delete(serialObject); | |
clear s; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment