Adafruit Ultimate GPS, SSD1306 0.96" 128x64 OLED, Arduino Uno sketch problems

I cannot for the life of me, get one bit of data from the GPS to display onto the LED.
Individually I can display text onto the OLED(OLED.ino) and I can retrieve data from the GPS and display it on the serial monitor using Serial.print (GPS.ino).

When I try to merge them, I’m getting major code errors AND running out of memory.
#include <Adafruit_SSD1306.h>
#include <Adafruit_GPS.h>

UGGGHH!!! Any guidance would be MUCH appreciated. Thanks

I'm thinking where it says: if (c) Serial.print(c); I should change that to: if (c) Serial.display(c); ? or display.display?

// in case you are not using the interrupt above, you'll
 // need to 'hand query' the GPS, not suggested :(
 if (! usingInterrupt) {
   // read data from the GPS in the 'main loop'
   char c = GPS.read();
   // if you want to debug, this is a good time to do it!
   if (GPSECHO)
   if (c) Serial.print(c);
 }
 
 // if a sentence is received, we can check the checksum, parse it...
 if (GPS.newNMEAreceived()) {
 
   if (!GPS.parse(GPS.lastNMEA()))   // this also sets the newNMEAreceived() flag to false
     return;  // we can fail to parse a sentence in which case we should just wait for another
 }

 // if millis() or timer wraps around, we'll just reset it
 if (timer > millis())  timer = millis();

 // approximately every 2 seconds or so, print out the current stats
 if (millis() - timer > 2000) { 
   timer = millis(); // reset the timer



   Serial.print("\nTime: ");
   Serial.print(GPS.hour-4, DEC); Serial.print(':');   
  Serial.println(GPS.minute, DEC);
   Serial.print("Date: ");
   Serial.print(GPS.month, DEC); Serial.print('/');
   Serial.print(GPS.day, DEC); Serial.print('/');
   Serial.print("/20");
   Serial.println(GPS.year, DEC);

   Serial.print("Fix: "); Serial.print((int)GPS.fix);
   Serial.print(" quality: "); 
   Serial.println((int)GPS.fixquality); 
   if (GPS.fix) {
    

     Serial.print("LAT/LON (in degrees): ");
     Serial.print(GPS.latitudeDegrees, 4);
     Serial.print(", "); 
     Serial.println(GPS.longitudeDegrees, 4);      
     Serial.print("MPH: "); Serial.println(GPS.speed*1.15077945);
     Serial.print("Heading: "); Serial.println((int)GPS.angle);
     Serial.print("Altitude: "); Serial.println(GPS.altitude);
     Serial.print("Satellites: "); Serial.println((int)GPS.satellites);
     Serial.println(" ");

   }
 }
}

You should attach the combined sketch you tried. The GFX library uses a lot of RAM, and updating the display can interfere with receiving GPS data. Careful coordination between the two is going to be required.

You might take a look at my NeoGPS library as an alternative to the Adafruit_GPS library. NeoGPS is much smaller and much more efficient, especially when combined with AltSoftSerial or NeoSWSerial instead of SoftwareSerial. SoftwareSerial is a real CPU-killer.

I wrote a description of the coordination problem here. It's one of the reasons I wrote NeoGPS.

Cheers, /dev

/DEV;

Are you asking to take a look at both sketches. I thought that would be asking too much and posting too much in one post

I did download both Neo GPS and SWSerial. I will be looking over the codes as I get free time to do so.

MyGPS.ino

// #include <SPI.h>
// #include <Wire.h>
// #include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <Adafruit_GPS.h>
#include <SoftwareSerial.h>

SoftwareSerial mySerial(7, 6);

Adafruit_GPS GPS(&mySerial);

// If using software SPI (the default case):
#define OLED_MOSI   9
#define OLED_CLK   10
#define OLED_DC    11
#define OLED_CS    12
#define OLED_RESET 13
Adafruit_SSD1306 display(OLED_MOSI, OLED_CLK, OLED_DC, OLED_RESET, OLED_CS);

/* Uncomment this block to use hardware SPI
#define OLED_DC     6
#define OLED_CS     7
#define OLED_RESET  8
Adafruit_SSD1306 display(OLED_DC, OLED_RESET, OLED_CS);
*/

#if (SSD1306_LCDHEIGHT != 64)
#error("Height incorrect, please fix Adafruit_SSD1306.h!");
#endif






/*  THIS DUMPS GPS NMEA DATA TO THE SERIAL MONITOR TO VERIFY IT'S WORKING
Set GPSECHO to 'false' to turn off echoing the GPS data to the Serial console
Set to 'true' if you want to debug and listen to the raw GPS sentences. */
#define GPSECHO  false

// this keeps track of whether we're using the interrupt
boolean usingInterrupt = false;
void useInterrupt(boolean); // Func prototype keeps Arduino 0023 happy


void setup(){
   
// Trying to send data to the screen **********************
     display.begin(SSD1306_SWITCHCAPVCC);
     display.display();
     delay(0);
     display.clearDisplay();

  // text display tests
  display.setTextSize(1);
  display.setTextColor(WHITE);
  display.setCursor(0,0);
  display.println();
  delay(0);
  display.clearDisplay();

//  *******************************************************





  // connect at 115200 so we can read the GPS fast enough and echo without dropping chars
  Serial.begin(115200);
  Serial.println("Adafruit GPS library basic test!");

  // 9600 NMEA is the default baud rate for Adafruit MTK GPS's- some use 4800
    GPS.begin(9600);
  // uncomment this line to turn on RMC (recommended minimum) and GGA (fix data) including altitude
   GPS.sendCommand(PMTK_SET_NMEA_OUTPUT_RMCGGA);
  
  // Set the update rate
  GPS.sendCommand(PMTK_SET_NMEA_UPDATE_1HZ);   // 1 Hz update rate
  // For the parsing code to work nicely and have time to sort thru the data, and
  // print it out we don't suggest using anything higher than 1 Hz

  // Request updates on antenna status, comment out to keep quiet 

  useInterrupt(true);
  delay(1000);
  // Ask for firmware version
  mySerial.println(PMTK_Q_RELEASE);
}


// Interrupt is called once a millisecond, looks for any new GPS data, and stores it
SIGNAL(TIMER0_COMPA_vect) {
  char c = GPS.read();
  // if you want to debug, this is a good time to do it!
#ifdef UDR0
  if (GPSECHO)
    if (c) UDR0 = c;  
    // writing direct to UDR0 is much much faster than Serial.print 
    // but only one character can be written at a time. 
#endif
}


void useInterrupt(boolean v) {
  if (v) {
    // Timer0 is already used for millis() - we'll just interrupt somewhere
    // in the middle and call the "Compare A" function above
    OCR0A = 0xAF;
    TIMSK0 |= _BV(OCIE0A);
    usingInterrupt = true;
  } else {
    // do not call the interrupt function COMPA anymore
    TIMSK0 &= ~_BV(OCIE0A);
    usingInterrupt = false;
  }
}

uint32_t timer = millis();
void loop()                     // run over and over again


{
 
  // in case you are not using the interrupt above, you'll
  // need to 'hand query' the GPS, not suggested :(
  if (! usingInterrupt) {
    // read data from the GPS in the 'main loop'
    char c = GPS.read();
    // if you want to debug, this is a good time to do it!
    if (GPSECHO)
    if (c) Serial.print (c);
  }
  
  // if a sentence is received, we can check the checksum, parse it...
  if (GPS.newNMEAreceived()) {
  
    if (!GPS.parse(GPS.lastNMEA()))   // this also sets the newNMEAreceived() flag to false
      return;  // we can fail to parse a sentence in which case we should just wait for another
  }

  // if millis() or timer wraps around, we'll just reset it
  if (timer > millis())  timer = millis();

  // approximately every 2 seconds or so, print out the current stats
  if (millis() - timer > 2000) { 
    timer = millis(); // reset the timer



    Serial.print("\nTime: ");
    Serial.print(GPS.hour-4, DEC); Serial.print(':');   
   Serial.println(GPS.minute, DEC);


  
    Serial.print("Date: ");
    Serial.print(GPS.month, DEC); Serial.print('/');
    Serial.print(GPS.day, DEC); Serial.print('/');
    Serial.print("/20");
    Serial.println(GPS.year, DEC);

    Serial.print("Fix: "); Serial.print((int)GPS.fix);
    Serial.print(" quality: "); 
    Serial.println((int)GPS.fixquality); 
    if (GPS.fix) {
     
 
      Serial.print("LAT/LON (in degrees): ");
      Serial.print(GPS.latitudeDegrees, 4);
      Serial.print(", "); 
      Serial.println(GPS.longitudeDegrees, 4);      
      Serial.print("MPH: "); Serial.println(GPS.speed*1.15077945);
      Serial.print("Heading: "); Serial.println((int)GPS.angle);
      Serial.print("Altitude: "); Serial.println(GPS.altitude);
      Serial.print("Satellites: "); Serial.println((int)GPS.satellites);
      Serial.println(" ");
    }
  }
  }

MyOLED.ino

//  #include <SPI.h>
//  #include <Wire.h>
//  #include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <Adafruit_GPS.h>
#include <SoftwareSerial.h>

// If using software SPI (the default case):
#define OLED_MOSI   9
#define OLED_CLK   10
#define OLED_DC    11
#define OLED_CS    12
#define OLED_RESET 13
Adafruit_SSD1306 display(OLED_MOSI, OLED_CLK, OLED_DC, OLED_RESET, OLED_CS);

/* Uncomment this block to use hardware SPI
#define OLED_DC     6
#define OLED_CS     7
#define OLED_RESET  8
Adafruit_SSD1306 display(OLED_DC, OLED_RESET, OLED_CS);
*/

#if (SSD1306_LCDHEIGHT != 64)
#error("Height incorrect, please fix Adafruit_SSD1306.h!");
#endif

void setup()   {                
  Serial.begin(9600);

  // by default, we'll generate the high voltage from the 3.3v line internally! (neat!)
  display.begin(SSD1306_SWITCHCAPVCC);
  // init done
  
   // Show the display buffer on the hardware.
  // NOTE: You _must_ call display after making any drawing commands
  // to make them visible on the display hardware!
 
 
  display.display();
  delay(0);
  display.clearDisplay();


  // draw scrolling text
  testscrolltext();
  delay(0);
  display.clearDisplay();

  // text display tests
  display.setTextSize(1);
  display.setTextColor(WHITE);
  display.setCursor(0,0);
  display.println();
  delay(0);
  display.clearDisplay();


}


void loop() {
  
}

void testscrolltext(void) {

  
  display.setTextSize(1);
  display.setTextColor(WHITE);
  display.setCursor(0,0);
//  display.clearDisplay();
  display.println("bmp");
  display.display();


 display.setTextColor(WHITE);
  display.setCursor(30,0);
 //  display.clearDisplay();
  display.println("GPS");
  display.display();

 display.setTextColor(WHITE);
  display.setCursor(85,0);
 //  display.clearDisplay();
  display.println("Time");
  display.display();

  
  display.setTextSize(4);
  display.setTextColor(WHITE);
  display.setCursor(50,18);
//  display.clearDisplay();
  display.println("MPH");
  display.display();


  display.setTextSize(1);
  display.setTextColor(WHITE);
  display.setCursor(10,57);
//  display.clearDisplay();
  display.println("Lat/Lon");
  display.display();

display.clearDisplay(); //  Refreshes the screen to poll new data from GPS
//  Now if I could only get the data to actually display in this sketch... : (

}

/dev;
Your sketches so far have been helpful. I did figure out how to change the rx, tx pins(6,7) in the GPSport.h file. That is how I have the arduino connected to the GPS.

When I try to merge them, I'm getting major code errors AND running out of memory.

As I said, "You should attach the combined sketch you tried."

Right now, we don't know if they're compiling errors or running errors. We only know you tried to merge them.

I did figure out how to change the rx, tx pins(6,7) in the GPSport.h file. That is how I have the arduino connected to the GPS.

Ok, did you try a NeoGPS example program? Did you get any output?

Can you hook the GPS to pins 8 & 9 instead of 6 & 7?

What GPS module are you using?

I did try your sketches and they worked just fine.
Pins 9-13 on my arduino Uno are used for the SSD1306 SPI OLED.
Using the Adafruit ultimate GPS breakout v3

GPStest.ino(merged sketch)

// #include <SPI.h>
// #include <Wire.h>
// #include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <Adafruit_GPS.h>
#include <SoftwareSerial.h>

SoftwareSerial mySerial(7, 6);

Adafruit_GPS GPS(&mySerial);

// If using software SPI (the default case):
#define OLED_MOSI   9
#define OLED_CLK   10
#define OLED_DC    11
#define OLED_CS    12
#define OLED_RESET 13
Adafruit_SSD1306 display(OLED_MOSI, OLED_CLK, OLED_DC, OLED_RESET, OLED_CS);

/* Uncomment this block to use hardware SPI
#define OLED_DC     6
#define OLED_CS     7
#define OLED_RESET  8
Adafruit_SSD1306 display(OLED_DC, OLED_RESET, OLED_CS);
*/

#if (SSD1306_LCDHEIGHT != 64)
#error("Height incorrect, please fix Adafruit_SSD1306.h!");
#endif






/*  THIS DUMPS GPS NMEA DATA TO THE SERIAL MONITOR TO VERIFY IT'S WORKING
Set GPSECHO to 'false' to turn off echoing the GPS data to the Serial console
Set to 'true' if you want to debug and listen to the raw GPS sentences. */
#define GPSECHO  false

// this keeps track of whether we're using the interrupt
boolean usingInterrupt = false;
void useInterrupt(boolean); // Func prototype keeps Arduino 0023 happy


void setup(){
   
// Trying to send data to the screen **********************
     display.begin(SSD1306_SWITCHCAPVCC);
     display.display();
     delay(0);
     display.clearDisplay();

  // text display tests
  display.setTextSize(1);
  display.setTextColor(WHITE);
  display.setCursor(0,0);
  display.println();
  delay(0);
  display.clearDisplay();

//  *******************************************************





  // connect at 115200 so we can read the GPS fast enough and echo without dropping chars
  Serial.begin(115200);
  Serial.println("Adafruit GPS library basic test!");

  // 9600 NMEA is the default baud rate for Adafruit MTK GPS's- some use 4800
    GPS.begin(9600);
  // uncomment this line to turn on RMC (recommended minimum) and GGA (fix data) including altitude
   GPS.sendCommand(PMTK_SET_NMEA_OUTPUT_RMCGGA);
  
  // Set the update rate
  GPS.sendCommand(PMTK_SET_NMEA_UPDATE_1HZ);   // 1 Hz update rate
  // For the parsing code to work nicely and have time to sort thru the data, and
  // print it out we don't suggest using anything higher than 1 Hz

  // Request updates on antenna status, comment out to keep quiet 

  useInterrupt(true);
  delay(1000);
  // Ask for firmware version
  mySerial.println(PMTK_Q_RELEASE);
}


// Interrupt is called once a millisecond, looks for any new GPS data, and stores it
SIGNAL(TIMER0_COMPA_vect) {
  char c = GPS.read();
  // if you want to debug, this is a good time to do it!
#ifdef UDR0
  if (GPSECHO)
    if (c) UDR0 = c;  
    // writing direct to UDR0 is much much faster than Serial.print 
    // but only one character can be written at a time. 
#endif
}


void useInterrupt(boolean v) {
  if (v) {
    // Timer0 is already used for millis() - we'll just interrupt somewhere
    // in the middle and call the "Compare A" function above
    OCR0A = 0xAF;
    TIMSK0 |= _BV(OCIE0A);
    usingInterrupt = true;
  } else {
    // do not call the interrupt function COMPA anymore
    TIMSK0 &= ~_BV(OCIE0A);
    usingInterrupt = false;
  }
}

uint32_t timer = millis();
void loop()                     // run over and over again


{
 
  // in case you are not using the interrupt above, you'll
  // need to 'hand query' the GPS, not suggested :(
  if (! usingInterrupt) {
    // read data from the GPS in the 'main loop'
    char c = GPS.read();
    // if you want to debug, this is a good time to do it!
    if (GPSECHO)
    if (c) Serial.print (c);
  }
  
  // if a sentence is received, we can check the checksum, parse it...
  if (GPS.newNMEAreceived()) {
  
    if (!GPS.parse(GPS.lastNMEA()))   // this also sets the newNMEAreceived() flag to false
      return;  // we can fail to parse a sentence in which case we should just wait for another
  }

  // if millis() or timer wraps around, we'll just reset it
  if (timer > millis())  timer = millis();

  // approximately every 2 seconds or so, print out the current stats
  if (millis() - timer > 2000) { 
    timer = millis(); // reset the timer



    Serial.print("\nTime: ");
    Serial.print(GPS.hour-4, DEC); Serial.print(':');   
   Serial.println(GPS.minute, DEC);


  
    Serial.print("Date: ");
    Serial.print(GPS.month, DEC); Serial.print('/');
    Serial.print(GPS.day, DEC); Serial.print('/');
    Serial.print("/20");
    Serial.println(GPS.year, DEC);

    Serial.print("Fix: "); Serial.print((int)GPS.fix);
    Serial.print(" quality: "); 
    Serial.println((int)GPS.fixquality); 
    if (GPS.fix) {
     
 
      Serial.print("LAT/LON (in degrees): ");
      Serial.print(GPS.latitudeDegrees, 4);
      Serial.print(", "); 
      Serial.println(GPS.longitudeDegrees, 4);      
      Serial.print("MPH: "); Serial.println(GPS.speed*1.15077945);
      Serial.print("Heading: "); Serial.println((int)GPS.angle);
      Serial.print("Altitude: "); Serial.println(GPS.altitude);
      Serial.print("Satellites: "); Serial.println((int)GPS.satellites);
      Serial.println(" ");
    }
  }
  }

Yes, with the first 3 includes uncommented, the build log (for an UNO, v1.0.5 IDE) says:

   Estimated used SRAM memory: 2,323 bytes (of a 2048 byte maximum)

Too big! If I use the F macro for all the double-quoted strings in the print statements, it says

   Estimated used SRAM memory: 2,187 bytes (of a 2048 byte maximum)

That saved 136 bytes of RAM. If I use NeoGPS and NeoSWSerial (see below), it says

   Estimated used SRAM memory: 1,723 bytes (of a 2048 byte maximum)

That saved 464 more bytes of RAM (a total of 600). So, it can fit. It’s a little tight, but it should work. Disabling fix pieces you don’t use in GPSfix_cfg.h could save a little more.

Cheers,
/dev


Your sketch modified to use NeoGPS:

#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <NeoSWSerial.h>

NeoSWSerial gps_port(7, 6);

#include "NMEAGPS.h"
static NMEAGPS  gps; // This parses the GPS characters

// If using software SPI (the default case):
#define OLED_MOSI   9
#define OLED_CLK   10
#define OLED_DC    11
#define OLED_CS    12
#define OLED_RESET 13
Adafruit_SSD1306 display(OLED_MOSI, OLED_CLK, OLED_DC, OLED_RESET, OLED_CS);

/* Uncomment this block to use hardware SPI
#define OLED_DC     6
#define OLED_CS     7
#define OLED_RESET  8
Adafruit_SSD1306 display(OLED_DC, OLED_RESET, OLED_CS);
*/

#if (SSD1306_LCDHEIGHT != 64)
#error("Height incorrect, please fix Adafruit_SSD1306.h!");
#endif


uint32_t timer;


void setup(){
   
// Trying to send data to the screen **********************
     display.begin(SSD1306_SWITCHCAPVCC);
     display.display();
     delay(0);
     display.clearDisplay();

  // text display tests
  display.setTextSize(1);
  display.setTextColor(WHITE);
  display.setCursor(0,0);
  display.println();
  delay(0);
  display.clearDisplay();

//  *******************************************************


  // connect at 115200 so we can read the GPS fast enough and echo without dropping chars
  Serial.begin(115200);

  Serial.println( F("NeoGPS library test!") );

  gps_port.begin(9600);

  // request RMC and GGA only
  gps.send_P( &gps_port, (const prog_char *) F("PMTK314,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0") );

  timer = millis();
}


void loop()                     // run over and over again
{
  while (gps_port.available()) {

    if (gps.decode( gps_port.read() ) == NMEAGPS::DECODE_COMPLETED) {

      if (gps.nmeaMessage == NMEAGPS::NMEA_GGA) {
      
        //  If your device emits a GGA then an RMC each second,
        //    change the above GGA to RMC.  Or if you don't get all
        //    the attributes (e.g., alt, heading, speed and satellites)
        //    try changing the above test.  NMEAorder.ino can be
        //    used to determine which one is last (should be used above).

        //  BTW, this is the safest place to do any time-consuming work,
        //    like updating the display.  Doing it elsewhere will cause GPS
        //    characters to be lost, and some fix data won't be available/valid.
        //    And if you take too long here, you could still lose characters.

        const gps_fix & fix = gps.fix();

        Serial.print( F("\nTime: ") );
        if (fix.valid.time) {
          Serial.print(fix.dateTime.hours-4, DEC); Serial.print(':');   
          Serial.print(fix.dateTime.minutes, DEC);
        }
        
        Serial.print( F("\nDate: ") );
        if (fix.valid.date) {
          Serial.print(fix.dateTime.month, DEC); Serial.print('/');
          Serial.print(fix.dateTime.date, DEC); Serial.print('/');
          Serial.print(fix.dateTime.full_year(), DEC);
        }

        Serial.print( F("\nFix: ") );
        Serial.print( fix.status );

        Serial.print( F(" quality: ") ); 
        if (fix.valid.hdop)
          Serial.print( fix.hdop/1000 ); 

        Serial.print( F("\nLAT/LON (in degrees): ") );
        if (fix.valid.location) {
          Serial.print(fix.latitude(), 4);
          Serial.print( F(", ") ); 
          Serial.print(fix.longitude(), 4);
        }

        Serial.print( F("\nMPH: ") );
        if (fix.valid.speed) {
          // convert integer (nautical miles/hr * 1000) to
          //    integer (miles/hr) and integer (miles/hr * 1000)
          uint32_t mph_E6 = fix.speed_mkn() * 1151UL;
          uint16_t mph = (mph_E6 / 1000000UL);
          uint16_t mph_frac = (mph_E6 - mph*1000000UL)/1000U;

          //  Print integer mph and mph_frac so it looks like a floating-point number
          Serial.print( mph );
          Serial.print( '.' );
          if (mph_frac < 100)
            Serial.print( '0' );
          if (mph_frac < 10)
            Serial.print( '0' );
          Serial.print( mph_frac );
        }
          
        Serial.print( F("\nHeading: ") ); 
        if (fix.valid.heading)
          Serial.print( fix.heading_cd()/100 );

        Serial.print( F("\nAltitude: ") );
        if (fix.valid.altitude)
          Serial.print( fix.altitude_cm()/100 );
        
        Serial.print( F("\nSatellites: ") );
        if (fix.valid.satellites)
          Serial.print( fix.satellites );

        Serial.println();

        timer = millis(); // reset the timer
      }
    }
  }

  // Until we get sentences, print a dot every 2 seconds or so
  if (millis() - timer > 2000) { 
    timer = millis(); // reset the timer

    Serial.print( '.' );
  }

}

Also, I had to uncomment this line in NMEA_cfg.h:

   #define NMEAGPS_ACCUMULATE_FIX

That allows NeoGPS to merge the GGA and the RMC sentence fields together, avoiding the need for a second copy of the GPS fix structure.

1st, I greatly appreciate your help!
When I verify the sketch, this is the error:

Arduino: 1.6.7 (Windows 7), Board: "Arduino/Genuino Uno"

C:\Users\User\Documents\Arduino\GPSTEST\GPSTEST.ino: In function 'void setup()':

GPSTEST:62: error: ISO C++ forbids declaration of 'type name' with no type [-fpermissive]

   gps.send_P( &gps_port, (const prog_char *) F("PMTK314,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0") );

                                 ^

GPSTEST:62: error: ISO C++ forbids declaration of 'type name' with no type [-fpermissive]

GPSTEST:62: error: expected primary-expression before 'const'

   gps.send_P( &gps_port, (const prog_char *) F("PMTK314,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0") );

                           ^

GPSTEST:62: error: expected ')' before 'const'

In file included from C:\Users\User\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.10\cores\arduino/Arduino.h:28:0,

                 from sketch\GPSTEST.ino.cpp:1:

C:\Users\User\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.10\cores\arduino/WString.h:38:74: error: expected ';' before ')' token

 #define F(string_literal) (reinterpret_cast<const __FlashStringHelper *>(PSTR(string_literal)))

                                                                          ^

C:\Users\User\Documents\Arduino\GPSTEST\GPSTEST.ino:62:46: note: in expansion of macro 'F'

   gps.send_P( &gps_port, (const prog_char *) F("PMTK314,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0") );

                                              ^

exit status 1
ISO C++ forbids declaration of 'type name' with no type [-fpermissive]

  This report would have more information with
  "Show verbose output during compilation"
  enabled in File > Preferences.

Sure, just use a print statement:

gps_port.println( F("$PMTK314,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0*29") );

It looks like a difference in the later version of the IDE (1.0.5 vs. 1.6.7).

Cheers, /dev

ok; So as it is now, it compiles with no errors but sill nothing on the OLED.

Can you please take another look as to what I did wrong?

// #include <SPI.h>
// #include <Wire.h>
// #include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <NeoSWSerial.h>
#include "NMEAGPS.h"

NeoSWSerial gps_port(7, 6);


static NMEAGPS  gps; // This parses the GPS characters

// If using software SPI (the default case):
#define OLED_MOSI   9
#define OLED_CLK   10
#define OLED_DC    11
#define OLED_CS    12
#define OLED_RESET 13
Adafruit_SSD1306 display(OLED_MOSI, OLED_CLK, OLED_DC, OLED_RESET, OLED_CS);

/* Uncomment this block to use hardware SPI
#define OLED_DC     6
#define OLED_CS     7
#define OLED_RESET  8
Adafruit_SSD1306 display(OLED_DC, OLED_RESET, OLED_CS);
*/

#if (SSD1306_LCDHEIGHT != 64)
#error("Height incorrect, please fix Adafruit_SSD1306.h!");
#endif


uint32_t timer;


void setup(){
   
  // connect at 115200 so we can read the GPS fast enough and echo without dropping chars
  Serial.begin(115200);

  Serial.println( F("NeoGPS library test!") );

  gps_port.begin(9600);

  // request RMC and GGA only
gps_port.println( F("$PMTK314,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0*29") );

  timer = millis();
}


void loop()                     // run over and over again
{
  while (gps_port.available()) {

    if (gps.decode( gps_port.read() ) == NMEAGPS::DECODE_COMPLETED) {

      if (gps.nmeaMessage == NMEAGPS::NMEA_GGA) {
      
        //  If your device emits a GGA then an RMC each second,
        //    change the above GGA to RMC.  Or if you don't get all
        //    the attributes (e.g., alt, heading, speed and satellites)
        //    try changing the above test.  NMEAorder.ino can be
        //    used to determine which one is last (should be used above).

        //  BTW, this is the safest place to do any time-consuming work,
        //    like updating the display.  Doing it elsewhere will cause GPS
        //    characters to be lost, and some fix data won't be available/valid.
        //    And if you take too long here, you could still lose characters.

        const gps_fix & fix = gps.fix();

/////////////////////////
        

// void testscrolltext(void) {
 
// Testing to see if I can get just Lat/Lon on the screen  ************************

  display.setTextSize(1);
  display.setTextColor(WHITE);
  display.setCursor(10,57);
  display.print( F("\nLAT/LON :  ") );
   if (fix.valid.location) {
   display.print(fix.latitude(), 4);
   display.print( F(", ") ); 
   display.print(fix.longitude(), 4);
   display.display();

// display.clearDisplay(); //  Refreshes the screen to poll new data from GPS
// STILL NOTHING!!!  ***************************************



/*
        Serial.print( F("\nTime: ") );
        if (fix.valid.time) {
          Serial.print(fix.dateTime.hours-4, DEC); Serial.print(':');   
          Serial.print(fix.dateTime.minutes, DEC);
        }
        
        Serial.print( F("\nDate: ") );
        if (fix.valid.date) {
          Serial.print(fix.dateTime.month, DEC); Serial.print('/');
          Serial.print(fix.dateTime.date, DEC); Serial.print('/');
          Serial.print(fix.dateTime.full_year(), DEC);
        }

        Serial.print( F("\nFix: ") );
        Serial.print( fix.status );

        Serial.print( F(" quality: ") ); 
        if (fix.valid.hdop)
          Serial.print( fix.hdop/1000 ); 

        Serial.print( F("\nLAT/LON (in degrees): ") );
        if (fix.valid.location) {
          Serial.print(fix.latitude(), 4);
          Serial.print( F(", ") ); 
          Serial.print(fix.longitude(), 4);   
        }

        Serial.print( F("\nMPH: ") );
        if (fix.valid.speed) {
          // convert integer (nautical miles/hr * 1000) to
          //    integer (miles/hr) and integer (miles/hr * 1000)
          uint32_t mph_E6 = fix.speed_mkn() * 1151UL;
          uint16_t mph = (mph_E6 / 1000000UL);
          uint16_t mph_frac = (mph_E6 - mph*1000000UL)/1000U;

          //  Print integer mph and mph_frac so it looks like a floating-point number
          Serial.print( mph );
          Serial.print( '.' );
          if (mph_frac < 100)
            Serial.print( '0' );
          if (mph_frac < 10)
            Serial.print( '0' );
          Serial.print( mph_frac );
        }
          
        Serial.print( F("\nHeading: ") ); 
        if (fix.valid.heading)
          Serial.print( fix.heading_cd()/100 );

        Serial.print( F("\nAltitude: ") );
        if (fix.valid.altitude)
          Serial.print( fix.altitude_cm()/100 );
        
        Serial.print( F("\nSatellites: ") );
        if (fix.valid.satellites)
          Serial.print( fix.satellites );

        Serial.println();       */

        timer = millis(); // reset the timer

   }
   }
    }
  }
   }

/*
  // Until we get sentences, print a dot every 2 seconds or so
  if (millis() - timer > 2000) { 
    timer = millis(); // reset the timer

    Serial.print( '.' );
    */

Ok, this section of code gets called after the GGA sentences arrives (the RMC came first):

 display.setTextSize(1);
  display.setTextColor(WHITE);
  display.setCursor(10,57);
  display.print( F("\nLAT/LON :  ") );
   if (fix.valid.location) {
   display.print(fix.latitude(), 4);
   display.print( F(", ") ); 
   display.print(fix.longitude(), 4);
   display.display();

Did my original sketch actually print anything? Because if it never printed real lat/lon values (i.e., non-empty values), your code will never update the display.

This is why indentation is so important. Add those spaces, or just press ^T in the IDE editor. Look at the if statement, then find the curly brace that matches that one... it's way down at the end.

The point is that the crucial display.display() call is inside the if statement. If you never get a valid location, the display will never get updated. Also, just before the ending curly brace, the timer gets reset. But it won't get reset if you don't get a valid location. I assume that's why you commented out that last part of loop that prints "....".

If the sketch I posted only prints ".....", then the GPS isn't even communicating with the sketch.

If my sketch prints "LAT/LON: ", with an empty lat/lon, once per second, then you're talking to the GPS ok, but you're not receiving any satellites. You may need to get close to a window or go outside.

Maybe you should try the NMEAdiagnostic.INO sketch, modified for your pins, and post what it says. And NMEAorder.ino, too. You said the Adafruit_GPS sketch worked, but I'm wondering if it ever had good satellite reception.

Cheers, /dev

I forgot to mention... Yes the GPS work and I do get NMEA sentences. When you click on serial monitor, it opens up a pop-up window just like when opening the arduino IDE. On that I can get it to show date, time Lat/Lon etc... I even copied the coordinates and pasted them into google and it was spot on. The sketch is just sending data to my OLED display.

OMG!!!! This is sooo frustrating. I just wasted an entire day trying to figure out why my oled wasn't working right. Turns out I shouldn't try writing code at night. I totally messed up my header file. I was getting what looked like a snow storm on the screen. I thought maybe I somehow burned out the oled. I wound up deleting the whole library and re-downloading from github. Back-up,back-up, back-up. Entire library in increments is helpful.

Now... Back to merging and compiling. FML

Wow. It finally compiled. On the serial monitor on my laptop it just reads:

Neo library test........................

And

My screen displayed the adafruit splash screen. Not what I wanted but it's doing two things at once. I know how to get rid of the splash screen. Not going to play with header file tonight. I don't want to waste entire day recovering from sleep deprived fingers.

When I run the NMEAloc.ino I get my GPS location so we're good. More crunching. I just might survive my OCD another day!!!

Thanks. When I have completely blown another gasket, I'll be back! Yeah, I'll be back...

Here’s my latest sketch:

#include <SPI.h>
#include <Wire.h>
// #include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <NeoSWSerial.h>

NeoSWSerial gps_port(7, 6);

#include "NMEAGPS.h"


static NMEAGPS  gps; // This parses the GPS characters

// If using software SPI (the default case):
#define OLED_MOSI   9
#define OLED_CLK   10
#define OLED_DC    11
#define OLED_CS    12
#define OLED_RESET 13
Adafruit_SSD1306 display(OLED_MOSI, OLED_CLK, OLED_DC, OLED_RESET, OLED_CS);


uint32_t timer;


void setup(){
   
// Trying to send data to the screen **********************


     display.begin(SSD1306_SWITCHCAPVCC);
     display.display();
     delay(2000);
     display.clearDisplay();
     display.display();



  
  // connect at 115200 so we can read the GPS fast enough and echo without dropping chars
  Serial.begin(115200);

  Serial.println( F("NeoGPS library test!") );

  gps_port.begin(9600);

  // request RMC and GGA only
gps_port.println( F("$PMTK314,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0*29") );

  timer = millis();
}


void loop()                     // run over and over again
{

  while (gps_port.available()) {

    if (gps.decode( gps_port.read() ) == NMEAGPS::DECODE_COMPLETED) {

      if (gps.nmeaMessage == NMEAGPS::NMEA_GGA) {
      
        //  If your device emits a GGA then an RMC each second,
        //    change the above GGA to RMC.  Or if you don't get all
        //    the attributes (e.g., alt, heading, speed and satellites)
        //    try changing the above test.  NMEAorder.ino can be
        //    used to determine which one is last (should be used above).

        //  BTW, this is the safest place to do any time-consuming work,
        //    like updating the display.  Doing it elsewhere will cause GPS
        //    characters to be lost, and some fix data won't be available/valid.
        //    And if you take too long here, you could still lose characters.


// ****************** trying to insert text here
//  If I cut and paste this above the
/* while (gps_port.available()) {

    if (gps.decode( gps_port.read() ) == NMEAGPS::DECODE_COMPLETED) {

      if (gps.nmeaMessage == NMEAGPS::NMEA_GGA) {  */
//***  it will display on the oled but where it is here, I get a blank screen???  ****

  display.setTextSize(1);
  display.setTextColor(WHITE);
  display.setCursor(0,0);
//  display.clearDisplay();
  display.println(F ("bmp"));
  display.display();

 display.setTextColor(WHITE);
  display.setCursor(30,0);
 //  display.clearDisplay();
  display.println( F("GPS"));
  display.display();


 display.setTextColor(WHITE);
  display.setCursor(85,0);
 //  display.clearDisplay();
  display.println( F("Time"));
  display.display();

 display.setTextSize(4);
  display.setTextColor(WHITE);
  display.setCursor(50,18);
//  display.clearDisplay();
  display.println( F("MPH"));
  display.display();


  display.setTextSize(1);
  display.setTextColor(WHITE);
  display.setCursor(10,57);
//  display.clearDisplay();
  display.println( F("Lat/Lon"));
  display.display();
  display.clearDisplay(); // Refreshes the screen to poll new data from GPS
// ***************************

        
        
        const gps_fix & fix = gps.fix();

        Serial.print( F("\nTime: ") );
        if (fix.valid.time) {
          Serial.print(fix.dateTime.hours-4, DEC); Serial.print(':');   
          Serial.print(fix.dateTime.minutes, DEC);
        }
        
        Serial.print( F("\nDate: ") );
        if (fix.valid.date) {
          Serial.print(fix.dateTime.month, DEC); Serial.print('/');
          Serial.print(fix.dateTime.date, DEC); Serial.print('/');
          Serial.print(fix.dateTime.full_year(), DEC);
        }

        Serial.print( F("\nFix: ") );
        Serial.print( fix.status );

        Serial.print( F(" quality: ") ); 
        if (fix.valid.hdop)
          Serial.print( fix.hdop/1000 ); 

        Serial.print( F("\nLAT/LON (in degrees): ") );
        if (fix.valid.location) {
          Serial.print(fix.latitude(), 4);
          Serial.print( F(", ") ); 
          Serial.print(fix.longitude(), 4);
        }

        Serial.print( F("\nMPH: ") );
        if (fix.valid.speed) {
          // convert integer (nautical miles/hr * 1000) to
          //    integer (miles/hr) and integer (miles/hr * 1000)
          uint32_t mph_E6 = fix.speed_mkn() * 1151UL;
          uint16_t mph = (mph_E6 / 1000000UL);
          uint16_t mph_frac = (mph_E6 - mph*1000000UL)/1000U;

          //  Print integer mph and mph_frac so it looks like a floating-point number
          Serial.print( mph );
          Serial.print( '.' );
          if (mph_frac < 100)
            Serial.print( '0' );
          if (mph_frac < 10)
            Serial.print( '0' );
          Serial.print( mph_frac );
        }
          
        Serial.print( F("\nHeading: ") ); 
        if (fix.valid.heading)
          Serial.print( fix.heading_cd()/100 );

        Serial.print( F("\nAltitude: ") );
        if (fix.valid.altitude)
          Serial.print( fix.altitude_cm()/100 );
        
        Serial.print( F("\nSatellites: ") );
        if (fix.valid.satellites)
          Serial.print( fix.satellites );

        Serial.println();

        timer = millis(); // reset the timer
      }
    }
  }

  // Until we get sentences, print a dot every 2 seconds or so
  if (millis() - timer > 2000) { 
    timer = millis(); // reset the timer

    Serial.print( '.' );
  }

}

If I cut and paste this above, it will display on the oled but where it is here, I get a blank screen???

I think you might be confused about these two methods:

  display.display();
  display.clearDisplay();

The first call transfers the current display "buffer" to the OLED over SPI. Whatever pixels have been set in the buffer will appear as lit pixels on the display.

The second call clears all the bits in the display buffer. It just sets all bytes of that array to 0. Nothing changes on the OLED display.

Your PC operates in much the same way. The graphics driver sets pixels in a memory array, and the magic hardware in the graphics card transfers them to your screen "over" VGA or HDMI. When apps make graphics driver calls to change the memory array, the graphics card changes what it sends to the screen.

The usual way of constructing an image is to start with a blank image, and then gradually add lines, text, bitmaps, etc. When the image is fully constructed, you send it to the display.

So you should be doing something like this:

 while (gps_port.available()) {

    if (gps.decode( gps_port.read() ) == NMEAGPS::DECODE_COMPLETED) {

      if (gps.nmeaMessage == NMEAGPS::NMEA_GGA) {

        uint32_t displayTime = micros(); // use this later, to figure out how long this takes.

        const gps_fix & fix = gps.fix();

        display.clearDisplay(); // start with a blank buffer

        // These attributes don't change between calls, just call them once
        display.setTextSize(1);
        display.setTextColor(WHITE);

        display.setCursor(0,0);
        display.println(F ("bmp"));

        display.setCursor(30,0);
        display.println( F("GPS"));

        display.setCursor(85,0);
        display.println( F("Time "));

        if (fix.valid.time) {
          display.print( fix.dateTime.hours-4, DEC ); display.print(':');
          display.print( fix.dateTime.minutes, DEC );
        }
            .
            .
            .

        // All done setting pixels, send the display buffer so we can see it!
        display.display();

        // Serial printing

        Serial.print( F("\nTime: ") );
        if (fix.valid.time) {
          Serial.print(fix.dateTime.hours-4, DEC); Serial.print(':');   
          Serial.print(fix.dateTime.minutes, DEC);
        }
            .
            .
            .

        Serial.print( F("dt = ") );
        Serial.print( micros() - displayTime ); // How long did all that take?
        Serial.println( F(" us") );
      }
    }
  }

Your sketch was transferring the entire display after each little change. That's unnecessary, and may cause the screen to flicker.

Also, You're probably printing too much Serial data. The above snippet prints how long the update process takes. If it's longer than 64000us, you're going to lose GPS characters.

Is your ctrl-T key broke? 'Cause if you can't take the time to format your code nicely for us to read, I'm going to take my toys and go home. -_- It. Is. Important.

/dev:
Is your ctrl-T key broke? 'Cause if you can’t take the time to format your code nicely for us to read, I’m going to take my toys and go home. -_- It. Is. Important.

Assuming you meant Ctrl-Shift-T in windows… I had to Google it. Did not know I could retrieve a previously closed tab that way. I have a lenovo Think pad. I have the mouse-pad (turned off) where my thumb touches periodically. For some reason, from time to time my opened tab closes and I have to go a round about way of re-loading it. Something to do with the pad turning on and off on it’s own.

NMEAdiagnostic.ino (6.6 KB)

NMEAorder.ino (6.46 KB)

Instead of attaching the jpg files, attach the ino files. You can modify your post. It's under the "More" button in the lower right.

The control-T key will auto-format your code in the IDE editor window. It indents everything properly.