Question about two codes

Hello, all

I have two separate codes when I compile code 1 in Arduino board then it's working.
that's also with code 2 but when I bind this two codes to one code then it's not working at all

if I then disable the of the code in the combine two code then it's working

how is this possible.

Post your combined code and any error messages you get when compiling

pvdbos:
how is this possible.

It is very possible but we won't know how unless you post your sketch.

pvdbos:
Oke, hire is my code.

You're a forum member with 59 post and you don't know how to use code tags?

No but can you help my with this.....

Sure. Read this: Read this before posting a programming question .... Pay particular attention to Item #6 that describes how to use Code Tags. Then, post your code correctly. You'll stand a much better chance of getting help by following forum guidelines.

OK, I didn't know that it was strict on rules so sorry.
but is this better!

the problem is that this code have no errors (visualmicro on VS2019) but it's not working.
when I disable the code of the BME280 then it works fine.
When I use the code of the BME280 in a separate code then the BME280 works also fine.

#include <SPI.h>
#include <Wire.h>
#include <Adafruit_SH1106.h>
#include <NeoSWSerial.h>
#include <NMEAGPS.h>
#include <Adafruit_GFX.h>
#include <Adafruit_BME280.h>
#include <Adafruit_Sensor.h>

#define SEALEVELPRESSURE_HPA (1013.25)

#define OLED_RESET 0
Adafruit_SH1106 display(OLED_RESET);
Adafruit_BME280 bme; // I2C
NMEAGPS gps;

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" };

static void adjustTime(NeoGPS::time_t& UTCtime);
static void printTime(gps_fix& fix);

void setup() {
 gps_port.begin(GPSBaud); //Arduino Serial
 display.begin(SH1106_SWITCHCAPVCC, 0x3C); // initialize with the I2C addr 0x3D (for the 128x64 OLED display)
 display.setTextSize(0); //Set default font size to the smalles
 display.setTextColor(WHITE, BLACK); //Set font to display color on black background
 display.invertDisplay(0);
 display.clearDisplay();
 bme.begin(0x76);
}

void loop() {
 while (gps.available(gps_port)) {
 gps_fix fix = gps.read();
 printTime(fix);
 }
bme280_censor();
}

static void printTime(gps_fix& fix) {
 display.drawLine(0, 16, 128, 16, WHITE);
 display.setCursor(10, 0);
 display.setTextSize(2);
 display.setTextColor(WHITE, BLACK);

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

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

 // Date
 display.setCursor(0, 22); // display.setCursor(0, 20);
 display.setTextSize(0);
 display.setTextColor(WHITE, BLACK);
 if (fix.valid.date) {
 fix.dateTime.set_day(); // set the "day" member from all the adjusted pieces
 display.print(dayName[fix.dateTime.day - 1]); // SUNDAY = 1, dayNames array starts at 0.
 display.print(' ');
 if (fix.dateTime.date < 10) display.print('0');
 display.print(fix.dateTime.date);
 display.print(' ');
 fix.dateTime.set_day(); // set the "day" member from all the adjusted pieces
 display.print(monthName[fix.dateTime.month - 1]); // SUNDAY = 1, dayNames array starts at 0.
 display.print(' ');
 if (fix.dateTime.full_year() < 10) display.print('0');
 display.print(fix.dateTime.full_year());
 }
 display.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 = 29; // 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 bme280_censor() {
 display.setCursor(0, 30);
 display.println("Temparat =");
 display.setCursor(120, 30);
 display.println("C");
 display.setCursor(64, 30);
 display.println(bme.readTemperature());

 display.setCursor(0, 38);
 display.print("Humidity =");
 display.setCursor(64, 38);
 display.print(bme.readHumidity());

 display.setCursor(0, 46);
 display.print("Pressure =");
 display.setCursor(64, 46);
 display.print(bme.readPressure() / 100.0F);

 display.setCursor(0, 54);
 display.print("Altitude =");
 display.setCursor(120, 54);
 display.print("m");
 display.setCursor(64, 54);
 display.print(bme.readAltitude(SEALEVELPRESSURE_HPA));
 display.display();
}

Is there someone how can help me out with this.

Tell us what "not working" means. What happens when you run the code? What should happen?

total, noting the display is blank!!!

What did your debug prints show when you instrumented the code with a bunch of Serial.print()?

okay i found out if I do the library //#include <Adafruit_BME280.h> set active "remove the //" without any code for the BME280 then my code is doing noting.

I think that there is a problem with this library???

I find this on this form that dare are more have this problem.
https://forum.arduino.cc/index.php?topic=470260.0