Another Update:
Took SAM-M8Q outside. Time to lock OK according to when led starts to flash.
Back to connecting both display and SAM-M8Q to same I2C port. ESP32 can, indeed, talk to both devices. However it appears as if SAM-8Q is not receiving satellite data when display library comes into play. I’ve inserted the sketch here:
#include <Wire.h> //Needed for I2C to GPS
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_Ublox_GPS
#include <MicroNMEA.h> //http://librarymanager/All#MicroNMEA
#include "SSD1306Wire.h" //for OLED Display
//___________________________Global Variables__________________________
SFE_UBLOX_GPS myGPS;
char nmeaBuffer[100];
MicroNMEA nmea(nmeaBuffer, sizeof(nmeaBuffer));
// I2C for GPS and display
#define SDA 21 //blue wire
#define SCL 22 //yellow wire
SSD1306Wire display(0x3c, SDA, SCL);
//------------------------SFE_UBLOX::processNMEA-----------------------
void SFE_UBLOX_GPS::processNMEA(char incoming)
{
nmea.process(incoming);
}
//__________________________________Setup______________________________
void setup(){
Serial.begin(115200);
Serial.println("");
Wire.begin();
// Initialize the display
display.init();
display.flipScreenVertically();
display.setFont(ArialMT_Plain_16);
if (myGPS.begin() == false)
{
Serial.println(F("Ublox GPS not detected at default I2C address. Please check wiring. Freezing."));
while (1);
}
myGPS.setI2COutput(COM_TYPE_NMEA); //Set the I2C port to output NMEA
myGPS.saveConfiguration(); //Save the current settings to flash and BBR
}
//__________________________________Loop______________________________
void loop(){
String OLEDline1, OLEDline2, OLEDline3;
myGPS.checkUblox(); //See if new data is available. Process bytes as they come in.
// if(nmea.isValid() == true)
// {
long latitude_mdeg = nmea.getLatitude();
long longitude_mdeg = nmea.getLongitude();
long altitude = nmea.getAltitude();
uint8_t satellites = nmea.getNumSatellites();
char navigationSystem = nmea.getNavSystem();
uint16_t year = nmea.getYear();
uint8_t month = nmea.getMonth();
uint8_t day = nmea.getDay();
uint8_t hour = nmea.getHour();
uint8_t minute = nmea.getMinute();
uint8_t second = nmea.getSecond();
long speed = nmea.getSpeed();
long course = nmea.getCourse();
uint8_t horizontalDOP = nmea.getHDOP();
Serial.printf("%02d/%02d/%d %02d:%02d:%02d\n" , month, day, year, hour, minute, second);
Serial.printf("Number of Satellites: %d, HDOP: %d, Navigation System: %c\n", satellites,
horizontalDOP, navigationSystem);
Serial.printf("Latitude: %0.6f deg, Longitude: %0.6f deg, altitude: %0.0f ft.\n",
latitude_mdeg/1000000.0, longitude_mdeg/1000000.0, altitude * 0.0032804);
Serial.printf("Speed: %1.3f knots, course: %1.3f \n", speed / 1000.0, course);
Serial.println();
//For Display
OLEDline1 = "SIV: ";
OLEDline1 += String(satellites);
OLEDline2 = "HDOP ";
OLEDline2 += String(horizontalDOP);
OLEDline3 = "Alt: ";
OLEDline3 += String(int(altitude * 0.0032804));
display.clear();
display.drawString(0, 0, OLEDline1);
display.drawString(0, 21, OLEDline2);
display.drawString(0, 47, OLEDline3);
display.display();
delay(250); //Don't pound too hard on the I2C bus
}
When run, the output looks like this (GPS led is flashing):
Has typical 999 data when there is no fix
If I comment out the three lines in setup() and the five lines in loop() starting with “display.” the output is OK as can be seen here:
Any Ideas?