I've had a Sparkfun Colour LCD shield for ages
I decided to build a new version of my "Tracker Jacker", so I tried the gLCD library, works great!
At least all the demos do.
I then tried a Mandelbrot program and a Conway's Life just to make sure it works.
THEN tried this
#include <TinyGPS.h>
#include <gLCD.h>
const char RST = 8;
const char CS = 9;
const char Clk = 13;
const char Data = 11;
gLCD graphic(RST,CS,Clk,Data,HIGH_SPEED); //High speed
TinyGPS gps;
void getgps(TinyGPS &gps);
int buttonPins[3] = {
3, 4, 5};
void getgps(TinyGPS &gps)
{
float latitude, longitude;
graphic.Clear();
graphic.setCoordinate(0,0);
gps.f_get_position(&latitude, &longitude);
graphic.print("Lat/Long: ");
graphic.print(latitude,5);
graphic.print(", ");
graphic.println(longitude,5);
int year;
byte month, day, hour, minute, second, hundredths;
gps.crack_datetime(&year,&month,&day,&hour,&minute,&second,&hundredths);
graphic.print("Date: "); graphic.print(month, DEC); graphic.print("/");
graphic.print(day, DEC); graphic.print("/"); graphic.println(year);
graphic.print(" Time: "); graphic.print(hour, DEC); graphic.print(":");
graphic.print(minute, DEC); graphic.print(":"); graphic.print(second, DEC);
graphic.print("."); graphic.println(hundredths, DEC);
graphic.print("Altitude (meters): "); graphic.println(gps.f_altitude());
graphic.print("Course (degrees): "); graphic.println(gps.f_course());
graphic.print("Speed(kmph): "); graphic.println(gps.f_speed_kmph());
}
void setup() {
Serial.begin(4800);
graphic.begin(0,0,0,EPSON); //Normal Epson
graphic.setBackColour(GLCD_BLACK);
graphic.setForeColour(GLCD_WHITE);
graphic.setFont(Normal_ClearBG);
graphic.setCoordinate(0,0);
graphic.Clear();
/* Set up the button pins as inputs, set pull-up resistor */
for (int i=0; i<3; i++)
{
pinMode(buttonPins[i], INPUT);
digitalWrite(buttonPins[i], HIGH);
}
}
void loop() {
int c;
while(Serial.available())
c = Serial.read();
if(gps.encode(c))
{
getgps(gps);
}
else
{
graphic.println("Waiting...");
}
}
Just sits outputting "Waiting..."
I know the GPS is working because I tried the tinyGPS library outputting to the serial monitor, that works great, the EM-406 LED is doing it's 1 flash/second thing, so I know the GPS is locked and loading NMEA sentences.
Have I missed something?