- do the configuration of GPS
- using the command that got from internet
- command for GPS (to read latitude and longitude of pointed point)
-study and make research about Arduino
Purpose:
- to create GPS data that can read the latitude and longitude of the pointed location
- to expose about the command that can be used in the Arduino
- study and try to find a solution why the program have many errors.
the sample of configuration
// include the SoftwareSerial library
#include <SoftwareSerial.h>
// Constants
#define rxPin 8 //rx pin in gps connection
#define txPin 9 //tx pin in gps connection
SoftwareSerial gps = SoftwareSerial(rxPin, txPin);
// variables
byte byteGPS1 = 0;
byte byteGPS2= 0;
byte byteGPS3 = 0;
byte byteGPS4 = 0;
byte byteGPS5 = 0;
int i = 0;
int h = 0;
int y = 0;
int addr = 0;
int conta_virgole = 0;
int conta_scritture = 0;
int nvirgole = 0;
String nSat = ""; //numero di satelliti visibili
int maxaddr = 1000;
String lat,latNS,lon,lonEW;
// Buffers for data input
char GPS_GGA[300]="";
void setup(){
pinMode(13, OUTPUT);
digitalWrite(13, LOW); // set the LED OFF
//setup for mySerial port
pinMode(rxPin, INPUT);
pinMode(txPin, OUTPUT);
gps.begin(4800);
//setup for Serial port
Serial.begin(9600);
delay(1000);
}
void loop()
{
Serial.println();
Serial.println("---Inizio---");
// Read GGA sentence from GPS
byteGPS3 = 0;
byteGPS3 = gps.read();
while(byteGPS3 != 'A'){
byteGPS3 = gps.read();
Serial.print(byteGPS3);//---- this----
}
GPS_GGA[0]='$';
GPS_GGA[1]='G';
GPS_GGA[2]='P';
GPS_GGA[3]='G';
GPS_GGA[4]='G';
GPS_GGA[5]='A';
y = 6;
while(byteGPS4 != '*'){
byteGPS4 = gps.read();
GPS_GGA[y]=byteGPS4;
Serial.print(byteGPS4);//---- this----
y++;
}
Serial.println();
// print the GGA sentence to USB
Serial.print("GGA sentence: ");
h = 0;
while(GPS_GGA[h] != 42){
Serial.print(GPS_GGA[h]);
h++;
}
delay(5000);
}
Reference:
-project supervisor
- Arduino website
- Arduino forum
Conclusion
- can add extra knowledge of arduino
No comments:
Post a Comment