i am very new to programming, i am trying to get a lcd screen to display gps calculated mph output. can someone look at my code and tell me what i am missing?
#include <TinyGPS++.h>
#include <SoftwareSerial.h>
#include <LiquidCrystal.h>
static const int RXPin = 4, TXPin = 3;
static const uint32_t GPSBaud = 9600;
LiquidCrystal lcd(7, 8, 9, 10, 11, 12);
// The TinyGPS++ object
TinyGPSPlus gps;
// The serial connection to the GPS device
SoftwareSerial ss(RXPin, TXPin);
void setup(){
Serial.begin(9600);
ss.begin(GPSBaud);
lcd.begin(16, 2);
}
void loop(){
while (ss.available() > 0){
gps.encode(ss.read());
if (gps.location.isUpdated()){
// Speed in miles per hour (double)
Serial.print("Speed in miles/h = ");
Serial.println(gps.speed.mph());
lcd.setCursor(0, 0);
lcd.print("Speed in mile/h = ");
lcd.setCursor(6, 0);
lcd.print(gps.speed.mph());
delay (500);
}
}
}
To debug your code, you can test your wiring connection first by running code for LCD only, and for GPS module only. If one of them does not work, fix it. If code for individual works, debug your combined code.
So you are saying i should verify that my lcd code displays characters from a different input? Then verify that the gps data shows up on the serial plotter? I have already tested both programs separately in similar scenarios but when i combine them, successfully compile, and upload to my porotype the gps is receiving and transmitting signal yet the lcd does not display my output.
Sending extra characters to the LCD will not break it but you do not know if it will display them or not. Example: you have a bucket that will hold 10 items, but you have 11. They will not fit but if you have a bucket that will hold 10 no problem.