NEO 6M GPS RECEIVER

gps reciver

The code can be downloaded at:

https://github.com/triantara/ARDUINO-TRIANTARA/blob/main/GPS.zip

/*
* Rui Santos
The module GND pin is connected to Arduino GND pin
The module RX pin is connected to Arduino pin 3
The module TX pin is connected to Arduino pin 4
The module VCC pin is connected to Arduino 5V pin
* Complete Project Details http://randomnerdtutorials.com
*/

#include <TinyGPS++.h>
#include <SoftwareSerial.h>

static const int RXPin = 4, TXPin = 3;
static const uint32_t GPSBaud = 9600;

// The TinyGPS++ object
TinyGPSPlus gps;

// The serial connection to the GPS device
SoftwareSerial ss(RXPin, TXPin);

//
#include <Wire.h>
#include <LCD.h>
#include <LiquidCrystal_I2C.h>
/*
For details about the LCD display with I2C support see
http://www.fasttech.com/reviews/1380909/22072
and
http://dx.com/p/funduino-iic-i2c-1602-lcd-adapter-board-w-2-5-lcd-screen-black-green-red-173588
The reviewer comments by docpayce and particularly JackWP associated with the two product pages above have been very useful.

Connect the LCD: VCC -> 5V, GND -> GND, SDA -> A4 (PortC4, ADC4), SCL -> A5 (PortC5, SDA)

The LiquidCrystal_I2C library needs to be downloaded and installed from here: https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/Home
*/

#define I2C_ADDR 0x27
#define BACKLIGHT_PIN 3
#define En_pin 2
#define Rw_pin 1
#define Rs_pin 0
#define D4_pin 4
#define D5_pin 5
#define D6_pin 6
#define D7_pin 7

LiquidCrystal_I2C lcd(I2C_ADDR,En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_pin,BACKLIGHT_PIN,POSITIVE);
LCD *myLCD = &lcd;

//
const int buttonPin = 2;
int buttonState = 0;
void setup(){
Serial.begin(9600);
ss.begin(GPSBaud);
//
pinMode(buttonPin, INPUT);
digitalWrite(buttonPin, LOW);
lcd.begin(16,2); // initialize the lcd
lcd.home (); // go home
lcd.print(“GPS ARDUINO”);
lcd.setCursor(0, 1);
lcd.print(“SIGNAL SEARCH”);
delay(100);
//
}

void loop(){
buttonState = digitalRead(buttonPin);

// check if the pushbutton is pressed.
// if it is, the buttonState is HIGH:
if (buttonState == HIGH) {
// turn LED on:
frezze();
}
else {
// turn LED off:
normdisplay();
}
}

void normdisplay(){
while (ss.available() > 0){
gps.encode(ss.read());
if (gps.location.isUpdated()){
Serial.print(“Latitude= “);
Serial.print(gps.location.lat(), 6);
Serial.print(” Longitude= “);
Serial.println(gps.location.lng(), 6);
//lcd.clear();
lcd.home ();
lcd.setCursor(0, 0);
lcd.print(“LAT=”);
lcd.setCursor(4, 0);
lcd.print(gps.location.lat(), 9);
lcd.setCursor(0, 1);
lcd.print(“LNG=”);
lcd.setCursor(4, 1);
lcd.print(gps.location.lng(), 9);
}
}
}

void frezze(){
while (ss.available() > 0){
gps.encode(ss.read());
if (gps.location.isUpdated()){
Serial.print(“Latitude= “);
Serial.print(gps.location.lat(), 6);
Serial.print(” Longitude= “);
Serial.println(gps.location.lng(), 6);
//lcd.clear();
lcd.home ();
lcd.setCursor(0, 0);
lcd.print(“LAT=”);
lcd.setCursor(4, 0);
lcd.print(gps.location.lat(), 9);
lcd.setCursor(0, 1);
lcd.print(“LNG=”);
lcd.setCursor(4, 1);
lcd.print(gps.location.lng(), 9);
delay(600000);
}
}
}