I am intending to show the initial, searching for signal..., screen until the location is updated and then show the location on the lcd. However, even after the led on the gps indicates a satellite fix, the screen never leaves the searching for signal screen. Any help would be greatly appreciated-- very new to microcontroller programming. Sorry for the poorly formatted code block as well, I am in a rush. Thanks in advance.
#include <SoftwareSerial.h>
#include <LiquidCrystal.h>
#include <TinyGPS++.h>
#define RXPin 2
#define TXPin 3
#define GPSBaud 4800
SoftwareSerial ss(RXPin, TXPin);
TinyGPSPlus gps;
LiquidCrystal lcd(12, 11, 10, 7, 6, 5, 4);
double latt;
double lon;
int screen;
void setup(void);
void loop(void);
void readGPS(void);
void update(void);
void render(void);
void setup() {
//variable initialization
latt = 0.0;
lon = 0.0;
screen = 0;
//lcd initial setup
pinMode(9, OUTPUT);
analogWrite(9, 100);
pinMode(13, OUTPUT);
digitalWrite(13, HIGH);
//display intial screen
lcd.begin(16,2);
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Searching for");
lcd.setCursor(6,2);
lcd.print("Signal ...");
ss.begin(GPSBaud);
}
void loop() {
readGPS();
update();
}
/** Receives data from the gps if available */
void readGPS() {
while (ss.available() > 0) {
gps.encode(ss.read());
}
}
/** Processes the data read by readGPS() */
void update() {
if (gps.location.isUpdated()) {
latt = gps.location.lat();
lon = gps.location.lng();
render();
}
}
/** Displays the current screen on the lcd */
void render() {
if (screen == 0) {
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Lat:");
lcd.print(latt);
lcd.print(" Lng:");
lcd.print(lon);
lcd.setCursor(0,1);
lcd.print("Sats:");
lcd.print(gps.satellites.value());
}
}