Way is this code not go to the sub code

I have a sub code where I have a Serial.println("testing"); in the code to check if the loop go's to the sub

void loop() {
	u8g2.firstPage();
	do {
		while (gps.available(gps_port)) {
			gps_fix fix = gps.read();
			printTime(fix);
		}
	} while (u8g2.nextPage());
}

but noting happens.

way???

is this the whole program? i don't see a sub-function or a call to Serial.println()

No. The code you can find hire.
https://forum.arduino.cc/index.php?topic=676714.0

pvdbos:
No. The code you can find hire.
NMEA GPS and u8g2 library blank screen - Programming Questions - Arduino Forum

Why not here?

The code you can find hire.

It would be better if it were here

Aim re-post this because my post of last week, nobody responds to my question.

pvdbos:
Aim re-post this because my post of last week, nobody responds to my question.

You still haven't posted the code that you're complaining about. No code, no answers.

Steve

OK here is my code. The Serial.print return the messages from the sub code thats now ok.
I see two lines the is in the code created, but there is no value from my GPS

#include <Wire.h>
#include <SPI.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BME680.h>
#include <NeoSWSerial.h>
#include <NMEAGPS.h>
#include <U8g2lib.h>


U8G2_SH1106_128X64_NONAME_2_HW_I2C u8g2(U8G2_R0, U8X8_PIN_NONE);
Adafruit_BME680 bme; // I2C
static const int RXPin = 16, TXPin = 15;
NeoSWSerial gps_port(RXPin, TXPin);
static const uint32_t GPSBaud = 9600;

char* dayName[] = { "ZONDAG", "MAANDAG", "DINSDAG", "WOENDAG", "DONDERDAG", "VRIJDAG", "ZATERDAG" };
char* monthName[] = { "JAN", "FEB", "MAA", "APR", "MEI", "JUN", "JUL", "AUG", "SEP", "OKT", "NOV", "DEC" };
NMEAGPS gps;
static void adjustTime(NeoGPS::time_t& UTCtime);
static void printTime(gps_fix& fix);

void setup() {
 Serial.begin(9600);
    gps_port.begin(GPSBaud);
    u8g2.begin();
    if (!bme.begin()) {
        while (1);
    }

    //bme.setTemperatureOversampling(BME680_OS_4X);
    //bme.setHumidityOversampling(BME680_OS_2X);
    //bme.setPressureOversampling(BME680_OS_4X);
    //bme.setIIRFilterSize(BME680_FILTER_SIZE_3);
    //bme.setGasHeater(320, 150); // 320*C for 150 ms
}

void loop() {
    u8g2.firstPage();
    do {
   draw();
   (gps.available(gps_port));
   gps_fix fix = gps.read();
   printTime(fix);
 } while (u8g2.nextPage());
}

static void printTime(gps_fix& fix) {
 u8g2.drawLine(0, 16, 128, 16);                             //<<<<<<<<<<<<< I only see this line
 u8g2.setCursor(10, 0);
 u8g2.setFont(u8g2_font_5x8_mf);
 Serial.println("printTime");
 // Time
 if (fix.valid.time) {
 adjustTime(fix.dateTime);
 if (fix.dateTime.hours < 10) u8g2.println('0');
 u8g2.println(fix.dateTime.hours);
 u8g2.println(':');
 if (fix.dateTime.minutes < 10) u8g2.println('0');
 u8g2.println(fix.dateTime.minutes);
 u8g2.println(':');
 if (fix.dateTime.seconds < 10) u8g2.println('0');
 u8g2.println(fix.dateTime.seconds);
 }

 // Satellites
 u8g2.setCursor(116, 56);
 if (fix.valid.satellites) {
 if (fix.satellites < 10) u8g2.println('0');
 u8g2.println(fix.satellites);
 }
 else
 u8g2.println("--");                                               //<<<<<<<<<<<<< And this line
 Serial.println("Sat-sub");

 // Date
 u8g2.setCursor(0, 22); display.setCursor(0, 20);
 if (fix.valid.date) {
 fix.dateTime.set_day(); // set the "day" member from all the adjusted pieces
 u8g2.println(dayName[fix.dateTime.day - 1]); // SUNDAY = 1, dayNames array starts at 0.
 u8g2.println(' ');
 if (fix.dateTime.date < 10) u8g2.println('0');
 u8g2.println(fix.dateTime.date);
 u8g2.println(' ');
 fix.dateTime.set_day(); // set the "day" member from all the adjusted pieces
 u8g2.println(monthName[fix.dateTime.month - 1]);// SUNDAY = 1, dayNames array starts at 0.
 u8g2.println(' ');
 if (fix.dateTime.full_year() < 10) u8g2.println('0');
 u8g2.println(fix.dateTime.full_year());
 }
 u8g2.display();
}

static void adjustTime(NeoGPS::time_t& UTCtime)
{
 NeoGPS::clock_t seconds = UTCtime;
 //  Daylight Savings Time rule (calculated once per reset and year!)
 static NeoGPS::time_t  changeover;
 static NeoGPS::clock_t springForward, fallBack;

 if ((springForward == 0) || (changeover.year != UTCtime.year)) {
 changeover.year = UTCtime.year;
 changeover.month = 3;
 changeover.date = 30; // last Sunday
 changeover.hours = 2; // am
 changeover.minutes = 0;
 changeover.seconds = 0;
 changeover.set_day();
 // Step back to the 4th Sunday, if day != SUNDAY
 changeover.date -= (changeover.day - NeoGPS::time_t::SUNDAY);
 springForward = (NeoGPS::clock_t) changeover;

 changeover.month = 10;
 changeover.date = 29; // last Sunday
 changeover.hours = 2; // am, adjusted for DST in effect at that time
 changeover.set_day();
 // Step back to the 4th Sunday, if day != SUNDAY
 changeover.date -= (changeover.day - NeoGPS::time_t::SUNDAY);
 fallBack = (NeoGPS::clock_t) changeover;
 }
 // Set these values to the offset of your timezone from GMT
 static const int32_t         zone_hours = +1L; // CET
 static const int32_t         zone_minutes = 0L; // zero for CET
 static const NeoGPS::clock_t zone_offset =
 zone_hours * NeoGPS::SECONDS_PER_HOUR +
 zone_minutes * NeoGPS::SECONDS_PER_MINUTE;

 seconds += zone_offset; // adjust!

 if ((springForward <= seconds) && (seconds < fallBack))
 seconds += NeoGPS::SECONDS_PER_HOUR;

 UTCtime = seconds; // convert back to a structure
}

void draw(void) {
    if (!bme.performReading()) {
        return;
    }
 u8g2.setFont(u8g2_font_5x8_mf);
    u8g2.setCursor(0, 24);
    u8g2.println(F("TEMP: = ")); u8g2.println(bme.temperature); u8g2.print("    C");

    u8g2.setCursor(0, 34);
    u8g2.println(F("PRES: = ")); u8g2.println(bme.pressure / 100); u8g2.println(F("  hPa"));

    u8g2.setCursor(0, 44);
    u8g2.println(F("HUMI: = ")); u8g2.println(bme.humidity); u8g2.println(F("    %"));

    u8g2.setCursor(0, 54);
    u8g2.println(F("GAS:  = ")); u8g2.println(bme.gas_resistance / 1000.0); u8g2.println(F(" KOhms"));
}

Well your code shows you have two objects and your are just passing the result set of one object to another object that does not understand the result set of the first object.

You'll need to write code to parse the result set of one object and translate to a format that can be used by the other object.

Did you do the #include <NMEAGPS.h> example to see how to parse the data?

if the problem is displaying text on some display, have you verified the text on the Serial monitor?

and you can use sprintf() to format a string instead of using multiple calls to print/println to piece a complete string together.

When I do only the code for the GPS same problem. When I use the SSD1306 Oled with the library from Adafruit then it works fine but with the SH1106 Oled and the u8g2 lib noting on the screen

/*
 Name: GPS.ino
 Created: 4/10/2020 5:15:09 PM
 Author: pvandenbos
*/

#include <SPI.h>
#include <Wire.h>
#include <U8g2lib.h>
#include <NeoSWSerial.h>
#include <NMEAGPS.h>

U8G2_SH1106_128X64_NONAME_2_HW_I2C u8g2(U8G2_R0, U8X8_PIN_NONE);

static const int RXPin = 16, TXPin = 15;
NeoSWSerial gps_port(RXPin, TXPin);
static const uint32_t GPSBaud = 9600;

static char* dayName[] = { "ZONDAG", "MAANDAG", "DINSDAG", "WOENDAG", "DONDERDAG", "VRIJDAG", "ZATERDAG" };
static char* monthName[] = { "JAN", "FEB", "MAR", "APR", "MEI", "JUN", "JUL", "AUG", "SEP", "OKT", "NOV", "DEC" };
NMEAGPS gps;
static void adjustTime(NeoGPS::time_t& UTCtime);
static void printTime(gps_fix& fix);

void setup(void) {
 Serial.begin(9600);
 gps_port.begin(GPSBaud);
 u8g2.setFont(u8g2_font_5x8_tf);
 u8g2.begin();
}

void loop() {
 u8g2.firstPage();
 do {
 while (gps.available(gps_port)) {
 gps_fix fix = gps.read();
 printTime(fix);
 }
 } while (u8g2.nextPage());
}

static void printTime(gps_fix& fix) {
 u8g2.drawLine(0, 16, 127, 16);
 u8g2.setCursor(10, 0);

 // Time
 if (fix.valid.time) {
 adjustTime(fix.dateTime);
 if (fix.dateTime.hours < 10) u8g2.print('0');
 u8g2.print(fix.dateTime.hours);
 u8g2.print(':');
 if (fix.dateTime.minutes < 10) u8g2.print('0');
 u8g2.print(fix.dateTime.minutes);
 u8g2.print(':');
 if (fix.dateTime.seconds < 10) u8g2.print('0');
 u8g2.print(fix.dateTime.seconds);
 }

 // Satellites
 u8g2.setCursor(116, 56);
 if (fix.valid.satellites) {
 if (fix.satellites < 10) u8g2.print('0');
 u8g2.print(fix.satellites);
 }
 else
 u8g2.print("--");

 // Date
 u8g2.setCursor(0, 22); // display.setCursor(0, 20);
 if (fix.valid.date) {
 fix.dateTime.set_day(); // set the "day" member from all the adjusted pieces
 u8g2.print(dayName[fix.dateTime.day - 1]); // SUNDAY = 1, dayNames array starts at 0.
 u8g2.print(' ');
 if (fix.dateTime.date < 10) u8g2.print('0');
 u8g2.print(fix.dateTime.date);
 u8g2.print(' ');
 fix.dateTime.set_day(); // set the "day" member from all the adjusted pieces
 u8g2.print(monthName[fix.dateTime.month - 1]); // SUNDAY = 1, dayNames array starts at 0.
 u8g2.print(' ');
 if (fix.dateTime.full_year() < 10) u8g2.print('0');
 u8g2.print(fix.dateTime.full_year());
 }
 u8g2.sendBuffer();
}

static void adjustTime(NeoGPS::time_t& UTCtime)
{
 NeoGPS::clock_t seconds = UTCtime;
 //  Daylight Savings Time rule (calculated once per reset and year!)
 static NeoGPS::time_t  changeover;
 static NeoGPS::clock_t springForward, fallBack;

 if ((springForward == 0) || (changeover.year != UTCtime.year)) {
 changeover.year = UTCtime.year;
 changeover.month = 3;
 changeover.date = 30; // last Sunday
 changeover.hours = 2; // am
 changeover.minutes = 0;
 changeover.seconds = 0;
 changeover.set_day();
 // Step back to the 4th Sunday, if day != SUNDAY
 changeover.date -= (changeover.day - NeoGPS::time_t::SUNDAY);
 springForward = (NeoGPS::clock_t) changeover;

 changeover.month = 10;
 changeover.date = 29; // last Sunday
 changeover.hours = 2; // am, adjusted for DST in effect at that time
 changeover.set_day();
 // Step back to the 4th Sunday, if day != SUNDAY
 changeover.date -= (changeover.day - NeoGPS::time_t::SUNDAY);
 fallBack = (NeoGPS::clock_t) changeover;
 }
 // Set these values to the offset of your timezone from GMT
 static const int32_t         zone_hours = +1L; // CET
 static const int32_t         zone_minutes = 0L; // zero for CET
 static const NeoGPS::clock_t zone_offset =
 zone_hours * NeoGPS::SECONDS_PER_HOUR +
 zone_minutes * NeoGPS::SECONDS_PER_MINUTE;

 seconds += zone_offset; // adjust!

 if ((springForward <= seconds) && (seconds < fallBack))
 seconds += NeoGPS::SECONDS_PER_HOUR;

 UTCtime = seconds; // convert back to a structure
}

OK so now you are writing that if you use one type of OLED display the program works fine and if you use another display the program does not work?

Could you define "code" and "sub code"? Could you explain what this means, "Way is this code not go to the sub code"?

Help 'us' help you.

I am looking to get this code working with a SH1106 1.3 inch OLED display. I have previously posted on this form but I have not received a response. Now I'm looking for a way to find out what the problem is so I thought it was the "loop" that it didn't go any further. The code should work it doesn't and I don't know why.

Can you explain way this is not working?

pvdbos:
I am looking to get this code working with a SH1106 1.3 inch OLED display. I have previously posted on this form but I have not received a response. Now I'm looking for a way to find out what the problem is so I thought it was the "loop" that it didn't go any further. The code should work it doesn't and I don't know why.

Did you get the SH1106 working with just the ug8 example code?

Yes the GraphicsTest.ino that is part of the u8g2 examples

I have two images to proof that my Oled SH1106 Works with examples of the u8g2 library

Here is some code, I am working on today.

#include <U8g2lib.h>
#include "freeRTOSSTUFF.h"
#include <OBD2UART.h>
////
const int SerialDataBits = 115200;
const int DisplayK = 45000;
////
U8G2_SH1106_128X64_NONAME_F_4W_HW_SPI u8g2(U8G2_R0, /* cs=*/ 5, /* dc=*/ 2, /* reset=*/ 4);
COBD obd;
/////////////////////////////////////////////////////////////////////////////////////////////
void setup()
{
   Serial.begin( SerialDataBits );
   byte version = obd.begin();
  log_i("Freematics OBD-II Adapter %d", version);
  if ( u8g2.begin() )
  {
    log_i( "u8gx.begin() all OK" );
  }
  //  //// CORE 0
  xTaskCreatePinnedToCore ( fUpdateDisplay, "fUpdateDisplay", DisplayK, NULL, Priority4, NULL, TaskCore0 ); // assigned to core
}
////
void loop() {}
/////////////////////////////////////////////////////
void fUpdateDisplay( void * parameter )
{
  int DispVal = 5;
  int Val = 0;
  u8g2.setFont(u8g2_font_ncenB08_tr); // choose a suitable font
  // int PositX_From, PositY_From, PositXto;
  for (;;)
  {
    u8g2.clearBuffer(); // clear the internal memory
    ////
    u8g2.drawStr( 0, 10, "Batt: " );
    u8g2.setCursor( 35, 10 ); u8g2.print( obd.getVoltage() );
    //
    u8g2.drawStr( 0, 20, "RPM:  " );
    if (obd.readPID( PID_RPM, Val ) )
    {
      u8g2.setCursor( 35, 20 ); u8g2.print( Val ); Val = 0;
    } else
    {
      u8g2.setCursor( 35, 20 ); u8g2.print( 0 );
    }
    // PID_COOLANT_TEMP
    u8g2.drawStr( 0, 30, "Coolant: " );
    if (obd.readPID( PID_COOLANT_TEMP, Val ) )
    {
      u8g2.setCursor( 50, 30 ); u8g2.print( Val ); Val = 0;
    } else
    {
      u8g2.setCursor( 50, 30 ); u8g2.print( 0 );
    }
    //
    u8g2.sendBuffer();          // transfer internal memory to the display
    vTaskDelay( 1000 );
  }
 vTaskDelete( NULL );
} // void fUpdateDisplay( void * parameter )

U8g2 uses a large image buffer, that may be causing a memory issue.

Are you using a Uno?

I am using a Arduino pro mini 3.3volt 8Mhz