Weather Stn code won't work on later laptop

I have weather stn code running on Arduino 1.5.5-r2. It compiles. It won't compile on a later computer running Arduino 1.8.18. I want to use the same LCD & Logger hardware for a new project. As far as I am able, I believe the same libraries exist on both machines. Error message attached. Wire not declared - why? "ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]" It worked before. Any suggestions of where I should look would be appreciated. Is this because the later Arduino IDE won't run code for the old version?

#include <avr/wdt.h> #include <SD.h> #include <Wire.h> #include <SPI.h> #include <Adafruit_MCP23017.h> #include <Adafruit_Sensor.h> #include <Adafruit_BME280.h> #include <RTClib.h> #include <Time.h> #include <TimeAlarms.h> #include <Adafruit_RGBLCDShield.h> #include <PinChangeInt.h> #define PIN 3 // the pin for button/ rain gauge #define STOP_SWITCH 2

Part of error message.

BME280WeaStn230718:113:3: error: 'Wire' was not declared in this scope

   Wire.begin();
C:\Users\User\Documents\Arduino\Codes\BME280WeaStn230718\BME280WeaStn230718.ino:136:20: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]

     error("Cd fail");

Need:

  1. The entire sketch
  2. The entire error message

try adding at the start of the code

#include <Wire.h>

what microcontroller are you using? have you changed it at all?
what do you select under Tools>Board?
have you tried version 2 of the IDE?

Mega 2560 - unchanged. Selected under Tools.Board.
Version 2 arrived when I downloaded the Arduino IDE to the newer laptop and I straight away got the same problem, so I searcehd for an older IDE and selected the oldest before ver 2.
Please excuse my lack of skill & memory! This code was written years ago.

Full sketch and full error message below.


#include <avr/wdt.h>
#include <SD.h>
#include <Wire.h>
#include <SPI.h>
#include <Adafruit_MCP23017.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BME280.h>
#include <RTClib.h>
#include <Time.h>
#include <TimeAlarms.h>
#include <Adafruit_RGBLCDShield.h>
#include <PinChangeInt.h>
#define PIN 3  // the pin for button/ rain gauge
#define STOP_SWITCH 2

// Suspect these 3 lines became necessary with SD_Master update
// set up variables using the SD utility library functions:
Sd2Card card;
SdVolume volume;
SdFile root;

bool stopped = false;
RTC_DS1307 RTC;
time_t syncProvider()     //this does the same thing as RTC_DS1307::get() but it is only a definition.
//. Copied the next line from an Alarm example.
//setSyncProvider(syncProvider);     //reference our syncProvider function instead of RTC_DS1307::get()
//This tells the Time library to sync the Arduino time to the RTC.
{
  return RTC.now().unixtime();
}

uint32_t syncTime = 0; // time of last sync()

// for the data logging shield, we use digital pin 10 for the SD cs line
const int chipSelect = 10;

// the logging files
File logfile;
File rainfile;
void error(char *str)
{
  Serial.print("error: ");
  Serial.println(str);
  while (1);
}
long mon = 0;
int dy = 0;
int hr = 0;
int mn = 0;
int sec = 0;
volatile int flag = 0;
int nflag;
int Run = 1;
int test = 1;
int nutim = 0;
int oldtim = 0;
int First = 0;
int Diff = 0;
char Dirn = 'N';
int prX = 1000;
int prN = 1000;
int pr2X = 1000;
int pr2N = 1000;
Adafruit_RGBLCDShield lcd = Adafruit_RGBLCDShield();
Adafruit_BME280 bme;
float temp;
float maxT;
float minT = 90;
float maxTy;
float minTy;
float rh = 0;
float rhX = 0;
float rhXY = 0;
float rhN = 90;
float rhNY = 90;
float pr = 0;
float prr = 1000;
byte _status;
long zerosec = millis();
unsigned long delayTime;

void setup()
{
  Serial.begin(9600);
  bool status;
  status = bme.begin();
  if (!status) {
    Serial.println("Could not find a valid BME280 sensor, check wiring!");
    while (1);
  }

 /* Serial.println("-- Sensor Test --");
  delayTime = 1000;
  Serial.println();
  delay(100); // let sensor boot up
  Serial.print("Temperature = ");
  temp = (bme.readTemperature());
  Serial.print(temp, 2);
  Serial.println(" *C");
  Serial.print("Pressure = ");
  pr = bme.readPressure();
  Serial.print(pr, 2);
  Serial.println(" hPa");
  Serial.print("Humidity = ");
  rh = bme.readHumidity();
  Serial.print(rh);
  Serial.println(" %");
  Serial.println();

  */// set up the LCD's number of columns and rows:
  lcd.begin(16, 2);
  Wire.begin();
  RTC.begin();
  if (! RTC.isrunning()) {
    // following line sets the RTC to the date & time this sketch was compiled so if it is used other than
    //on load time, the RTC time will be set back to whatever time and date compilation occured.
    // this can be improved by issuing warning if RTC time is behind arduino time using an If.
    RTC.adjust(DateTime(__DATE__, __TIME__));
  }
  //RTC.adjust(DateTime(__DATE__, __TIME__)); //Comment this once local time has been set.
  //setSyncProvider(syncProvider);     //reference our syncProvider function instead of RTC_DS1307::get()

  //configure pin2 as an input and enable the internal pull-up resistor
  pinMode(STOP_SWITCH, INPUT_PULLUP);

  // initialize the SD card
  Serial.print("InitSD");
  // make sure that the default chip select pin is set to
  // output, even if you don't use it:
  pinMode(53, OUTPUT);  //53 required for Mega

  // see if the card is present and can be initialized:
  if (!SD.begin(10, 11, 12, 13))
  {
    error("Cd fail");
  }
  Serial.println("cdinit.");
  // create a new file
  char filename[] = "LOGGER00.CSV";
  for (uint8_t i = 0; i < 100; i++)
  {
    filename[6] = i / 10 + '0';
    filename[7] = i % 10 + '0';
    if (! SD.exists(filename)) {
      // only open a new file if it doesn't exist
      logfile = SD.open(filename, FILE_WRITE);
      break;  // leave the loop!
    }
  }

  if (! logfile) {
    error("No lgfile");
  }

  Serial.print("Log to ");
  Serial.println(filename);
  Serial.println();

  // create a new file
  char filename2[] = "RAINEY00.CSV";
  for (uint8_t i = 0; i < 100; i++)
  {
    filename2[6] = i / 10 + '0';
    filename2[7] = i % 10 + '0';
    if (! SD.exists(filename2)) {
      // only open a new file if it doesn't exist
      rainfile = SD.open(filename2, FILE_WRITE);
      break;  // leave the loop!
    }
  }
  //This should work but does not - why?
  /*  if (! rainfile) {
    error("couldnt create rnfile");
    }
   */
  Serial.print("Log to ");
  Serial.println(filename2);
  Serial.println();
  
  /* DateTime now = RTC.now();  // to  test that the time is correct.
    mon = now.month();
    dy = now.day();
    hr = now.hour();
    mn = now.minute();
    Serial.print(mon);
    Serial.print(";");
    Serial.print(hr);
    Serial.print(':');
    Serial.print(mn);
*/
  pinMode(PIN, INPUT);     //set the pin to input
  digitalWrite(PIN, LOW);  //1 Megohm physical to -ve
  attachInterrupt(digitalPinToInterrupt(3), burpcount, RISING);
  // attach an Interrupt to our pin for the rising edge.
  // and execute the function burpcount when that pin changes.

  /*Information on :- attachInterrupt(digitalPinToInterrupt(pin), ISR, mode);

  interrupt: 	the number of the interrupt (int)
  pin: 		the pin number 	(Arduino Due, Zero, MKR1000 only)
  ISR: 		the ISR to call when the interrupt occurs; this function must take no parameters and return
  		nothing. This function is sometimes referred to as an interrupt service routine.
  mode: 		defines when the interrupt should be triggered. Four constants are predefined as valid values:

      		LOW to trigger the interrupt whenever the pin is low,
      		CHANGE to trigger the interrupt whenever the pin changes value
      		RISING to trigger when the pin goes from low to high,
      		FALLING for when the pin goes from high to low.
   */ // and execute the function burpcount when that pin changes.

  //2 line to kick off imediately.
  //Repeat3(); //Loggs Midnight max & Min and Monthly heading on 1st.
  Repeats(); //Main half-hourly logging of Temp, RH & Pressure.    This calls Time now for testing
  Repeat2(); // 8 second update display on LCD - 3 separete pages.  This calls Time now for testing
  Alarm.timerRepeat(8, Repeat2);  // LCD display, 8 seconds.
  Alarm.alarmRepeat(0, 1, 0, Repeat3); // One minute past Midnight date and Max/Min.
  while (minute() != 0) //Prog holds here until the hour so that logging is on the hour and the half hour.
  {
    delay(1000);
  }
 
  Serial.print(" setup minute ");
  Serial.println(minute(), DEC);
  Alarm.timerRepeat(1800, Repeats); //Main half-hourly logging of Temp, RH & Pressure. All Alarms run outside the loop.
 
  wdt_enable(WDTO_8S);  // Watch Dog timer set to 8 seconds.
}

void loop()
{
  if (LOW == digitalRead(STOP_SWITCH)) {
    logfile.flush();
    rainfile.flush();
    Serial.println("flush");
    delay(10); //switch debounce interval

    while (LOW == digitalRead(STOP_SWITCH)) {  //stick here until stop switch is turned off.
      stopped = true;
      wdt_reset();  // prevents a sketch restart while stop switch is in use.
    }
  }
      stopped = false;  //stop switch currently turned off

  Alarm.delay(0); // wait 0 seconds - something needed here or alarm does not work

  if (flag != nflag) {
    DateTime now = RTC.now();
    mon = now.month();
    dy = now.day();
    hr = now.hour();
    mn = now.minute();
    sec = now.second();
    nutim = mn;
    if ((nutim - oldtim) >= 2) {
      test = 1;
    }
    oldtim = mn;
    rainfile.print(flag);
    rainfile.print(";");
    rainfile.print(dy);
    rainfile.print("/");
    rainfile.print(mon);
    rainfile.print(";");
    rainfile.print(hr);
    rainfile.print(':');
    rainfile.print(mn);
    rainfile.print(':');
    rainfile.print(sec);
    rainfile.println();

    if (test == 1) {
      rainfile.flush();
      Serial.println(F("flushed"));
    }
    test = 0;
  }
  nflag = flag;
  wdt_reset();
}

void Repeats() {  //  Every 30 minutes.
 DateTime now = RTC.now();
  logfile.print(now.day(), DEC);
  logfile.print("/");
  logfile.print(now.month(), DEC);
  logfile.print("/");
  logfile.print(now.year(), DEC);
  logfile.print(",");
  logfile.print(now.hour(), DEC);
  Serial.print(now.hour(), DEC);
  logfile.print(":");
  logfile.print(now.minute(), DEC);
  Serial.println(now.minute(), DEC);
  logfile.print(", ");
  logfile.print(" RH ");
  logfile.print(rh);
  logfile.print(",");
  logfile.print("T ");
  logfile.print(temp);
  logfile.print(",");
  logfile.print("P ");
  Serial.print("P ");
  logfile.print(pr, 1);
  Serial.println(pr, 1);
  //logfile.print(";");
  logfile.println();
  logfile.flush();
}

void Repeat2() {
  //LCD pressure, rain,Temp & Line 2 humidity.
  rh = (bme.readHumidity());
  pr = (bme.readPressure());
  temp = (bme.readTemperature());

  maxT = max(temp, maxT); // these Max & Mins work for all readings of temp, until reset after midnight.
  minT = min(temp, minT);

  rhX = max(rh, rhX);
  rhN = min(rh, rhN);
  pr = pr / 100;
  pr = round (pr);
 /* Serial.print(F("Rpt2 minute "));
  Serial.println(minute());
  Serial.print("prr = ");
  Serial.println(prr );
 */ if (minute() == 0) {
    prr = pr;
    pr2X = pr;
    pr2N = pr;
  }
  // prr is 7 or 8 readings of Pressure taken during minute 0, top of the hour.
  
  pr2X = max(pr, pr2X);     // These two lines collect the max & Min of 60 minute readings.
  pr2N = min(pr, pr2N);
  
  prX = max(pr, prX);       // These two lines collect the max & Min of 24h readings.
  prN = min(pr, prN);

  if (pr2X > (prr + 1)) {   // this block compares the hour reading with the max or min during the hour every 8 seconds
    Diff = (pr2X - prr);
    Dirn = 'D';
  }
  else if (pr2N < (prr - 1)) {
    Diff = (prr - pr2N);
    Dirn = 'U';
  }
  else {
    Diff = 0;
    Dirn = '=';
  }
  
  switch (Run) {
    case 1:
      lcd.setCursor(0, 0);
      lcd.print(F("                "));
      lcd.setCursor(0, 0);
      lcd.print(F("P"));
      lcd.print(pr, 0);
      lcd.print(" ");
      lcd.print(Dirn);
      lcd.print(Diff);  //Change since last hour point.Ex 16 characters: P1009 U99 Rn9999
      //lcd.setCursor(10, 0);
      lcd.print(F(" Rn"));
      lcd.print(flag);
      lcd.setCursor(0, 1); // 2nd row
      lcd.print(F("Temp"));  //Ex 16 char Temp29.1 RH 88.1
      lcd.print(temp, 1);
      lcd.print(F(" RH "));
      lcd.println(rh, 1);
      Run ++ ;
      break;

    case 2:
      lcd.setCursor(0, 0);// LCD Max & Min temp and Yesterdays Max and Min temp line 2
      lcd.print(F("                ")); // Wipes line clean, otherwise previous data remains.
      lcd.setCursor(0, 0);
      lcd.print(F("Max"));  //Ex 16 characters Max33.5 Min17.5
      lcd.print(maxT, 1);
      lcd.print(F(" "));
      lcd.print(F("Min"));
      lcd.print(minT, 1);
      lcd.setCursor(0, 1);
      lcd.print(F("                "));
      lcd.setCursor(0, 1);
      lcd.print(F("Yx "));  //16 characters Yx 15.5 Yn 13.2
      lcd.print(maxTy, 1);
      lcd.print(F(" Yn "));
      lcd.print(minTy, 1);
      Run ++ ;
      break;

    case 3:
      lcd.setCursor(0, 0);// LCD max and Min RH and Yesterdays Max & Min RH line 2.
      lcd.print(F("                ")); // Wipes line clean, otherwise previous data remains.
      lcd.setCursor(0, 0);
      lcd.print(F("RHX"));  // 16 characters RHX60.1 RHN 45.3
      lcd.print(rhX, 1);  //  RH Max
      lcd.print(F(" "));
      lcd.print(F("RHN "));
      lcd.print(rhN, 1);  //  RH Min
      lcd.setCursor(0, 1);
      lcd.print(F("                "));
      lcd.setCursor(0, 1);
      lcd.print(F("RMY"));  // Ex 16 characters RMY88.9 RNY 44.5
      lcd.print(rhXY, 1);  // Yesterday RH Max
      lcd.print(F(" RNY "));
      lcd.print(rhNY, 1);  // Yesterday RH Min
      Run = 1;
      break;
  }
}
void Repeat3() {
  DateTime now = RTC.now();
  if (now.day() == 1 && now.month() == 1) {
    logfile.println(now.year());
    logfile.print(",");
    logfile.println(F("January"));
  }
  if (now.day() == 1 && now.month() == 2)
    logfile.print(F("February"));

  if (now.day() == 1 && now.month() == 3)
    logfile.print(F("March"));

  if (now.day() == 1 && now.month() == 4)
    logfile.print(F("April"));

  if (now.day() == 1 && now.month() == 5)
    logfile.print(F("May"));

  if (now.day() == 1 && now.month() == 6)
    logfile.print(F("June"));

  if (now.day() == 1 && now.month() == 7)
    logfile.print(F("July"));

  if (now.day() == 1 && now.month() == 8)
    logfile.print(F("August"));

  if (now.day() == 1 && now.month() == 9)
    logfile.print(F("September"));

  if (now.day() == 1 && now.month() == 10)
    logfile.print(F("October"));

  if (now.day() == 1 && now.month() == 11)
    logfile.print(F("November"));

  if (now.day() == 1 && now.month() == 12)
    logfile.print(F("December"));
  logfile.print(";");
  logfile.print(";");
  logfile.print(";");
  logfile.print(";");
  logfile.print(";");
  logfile.print(";");
  logfile.print(";");
  logfile.print("TMax ");
  logfile.print(maxT, 2);
  logfile.print(" TMin ");
  logfile.print(minT, 2);
  logfile.print(" RH Max ");
  logfile.print(rhX, 2); 
  logfile.print(" RH Min ");
  logfile.print(rhN, 2);
  logfile.println();
  logfile.flush();
  maxTy = maxT;
  minTy = minT;
  maxT = 0;
  minT = 99;
  rhXY = rhX;
  rhNY = rhN;
  rhX = 0;
  rhN = 90;
  
}

void burpcount()
{
  flag++;
}

Arduino: 1.8.18 (Windows 10), Board: "Arduino Mega or Mega 2560, ATmega2560 (Mega 2560)"

In file included from C:\Users\User\Documents\Arduino\Codes\BME280WeaStn230718\BME280WeaStn230718.ino:11:0:

C:\Users\User\Documents\Arduino\libraries\TimeAlarms/TimeAlarms.h:71:31: error: 'timeDayOfWeek_t' does not name a type

AlarmID_t alarmRepeat(const timeDayOfWeek_t DOW, const int H, const int M, const int S, OnTick_t onTickHandler); // as above, with day of week

                           ^~~~~~~~~~~~~~~

C:\Users\User\Documents\Arduino\libraries\TimeAlarms/TimeAlarms.h:75:29: error: 'timeDayOfWeek_t' does not name a type

AlarmID_t alarmOnce(const timeDayOfWeek_t DOW, const int H, const int M, const int S, OnTick_t onTickHandler); // as above, with day of week

                         ^~~~~~~~~~~~~~~

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

BME280WeaStn230718:113:3: error: 'Wire' was not declared in this scope

Wire.begin();

^~~~

C:\Users\User\Documents\Arduino\Codes\BME280WeaStn230718\BME280WeaStn230718.ino:113:3: note: suggested alternative: 'Dirn'

Wire.begin();

^~~~

Dirn

C:\Users\User\Documents\Arduino\Codes\BME280WeaStn230718\BME280WeaStn230718.ino:136:20: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]

 error("Cd fail");

                ^

C:\Users\User\Documents\Arduino\Codes\BME280WeaStn230718\BME280WeaStn230718.ino:153:22: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]

 error("No lgfile");

                  ^

BME280WeaStn230718:218:10: error: 'minute' was not declared in this scope

while (minute() != 0) //Prog holds here until the hour so that logging is on the hour and the half hour.

      ^~~~~~

C:\Users\User\Documents\Arduino\Codes\BME280WeaStn230718\BME280WeaStn230718.ino:218:10: note: suggested alternative: 'minTy'

while (minute() != 0) //Prog holds here until the hour so that logging is on the hour and the half hour.

      ^~~~~~

      minTy

BME280WeaStn230718:224:18: error: 'minute' was not declared in this scope

Serial.println(minute(), DEC);

              ^~~~~~

C:\Users\User\Documents\Arduino\Codes\BME280WeaStn230718\BME280WeaStn230718.ino:224:18: note: suggested alternative: 'minTy'

Serial.println(minute(), DEC);

              ^~~~~~

              minTy

C:\Users\User\Documents\Arduino\Codes\BME280WeaStn230718\BME280WeaStn230718.ino: In function 'void Repeat2()':

BME280WeaStn230718:328:9: error: 'minute' was not declared in this scope

*/ if (minute() == 0) {

     ^~~~~~

C:\Users\User\Documents\Arduino\Codes\BME280WeaStn230718\BME280WeaStn230718.ino:328:9: note: suggested alternative: 'minTy'

*/ if (minute() == 0) {

     ^~~~~~

     minTy

Multiple libraries were found for "Adafruit_MCP23017.h"

Used: C:\Users\User\Documents\Arduino\libraries\Adafruit_MCP23017_Arduino_Library_master

Not used: C:\Users\User\Documents\Arduino\libraries\Adafruit_RGB_LCD_Shield_Library_master

exit status 1

'Wire' was not declared in this scope

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

probably what has happened is not only has the IDE changed but libraries have changed and been updated
e.g. I think that

#include <Adafruit_MCP23017.h>

should now be

#include <Adafruit_MCP23X17.h> 

you could try reinstalling the IDE (move to version 2) and the libraries
use the Windows Programs and Features command to remove the old IDE(s)
also delete the folder Documents\Arduino\libraries
attempt to compile the code - use the libraray manager to instal libraries as error messages are displayed
you will find some library names have changed
once all the #includes work you will probably find some library function calls have changed

OK Thanks, I shall give it a try.
I have an old version of the Adafruit Logger - without the amended PEC. Strangely Adafruit suggests, under the page dealing with using the old logger shield, to download the "New" library. I have queried this with no response, but I suspected that it may have been an Adfruit typo. It seems logical that the old logger shield would need the old library - just as it is still working for me on the old laptop. So I doubt that your suggestion of <Adafruit_MCP23X17.h> may be correct - but anything is worth a try. (and what do I know?) Thanks - tomorrow.

I uninstalled the older IDE and installed version 2. I did not delete the libraries. After installing version 2 I was offered to update some librariess (BME280, which also required BusIO and Unified sensor, and HTU21DF) I get 5 pages of errors; Wire seems to be a particular problem.
I had a second go, uninstalling the ver 2 and deleting the libraries, but then I wanted to install the wire library and could not find it in Arduinos list. so I stopped there. Here are the error pages from the first try.

In file included from C:\Users\User\Documents\Arduino\libraries\Adafruit_BME280_Library/Adafruit_BME280.h:26:0,
                 from C:\Users\User\Documents\Arduino\Codes\BME280WeaStn230718\BME280WeaStn230718.ino:8:
C:\Users\User\Documents\Arduino\libraries\Adafruit_BusIO/Adafruit_I2CDevice.h:10:36: error: 'TwoWire' has not been declared
   Adafruit_I2CDevice(uint8_t addr, TwoWire *theWire = &Wire);
                                    ^~~~~~~
C:\Users\User\Documents\Arduino\libraries\Adafruit_BusIO/Adafruit_I2CDevice.h:30:3: error: 'TwoWire' does not name a type
   TwoWire *_wire;
   ^~~~~~~
C:\Users\User\Documents\Arduino\libraries\Adafruit_BusIO/Adafruit_I2CDevice.h:10:56: error: 'Wire' was not declared in this scope
   Adafruit_I2CDevice(uint8_t addr, TwoWire *theWire = &Wire);
                                                        ^~~~
C:\Users\User\Documents\Arduino\libraries\Adafruit_BusIO/Adafruit_I2CDevice.h:10:56: note: suggested alternative: 'File'
   Adafruit_I2CDevice(uint8_t addr, TwoWire *theWire = &Wire);
                                                        ^~~~
                                                        File
In file included from C:\Users\User\Documents\Arduino\libraries\Adafruit_BME280_Library/Adafruit_BME280.h:27:0,
                 from C:\Users\User\Documents\Arduino\Codes\BME280WeaStn230718\BME280WeaStn230718.ino:8:
C:\Users\User\Documents\Arduino\libraries\Adafruit_BusIO/Adafruit_SPIDevice.h:120:3: error: 'SPISettings' does not name a type
   SPISettings *_spiSetting = nullptr;
   ^~~~~~~~~~~
In file included from C:\Users\User\Documents\Arduino\Codes\BME280WeaStn230718\BME280WeaStn230718.ino:8:0:
C:\Users\User\Documents\Arduino\libraries\Adafruit_BME280_Library/Adafruit_BME280.h:116:8: error: conflicting return type specified for 'virtual bool Adafruit_BME280_Temp::getEvent(sensors_event_t*)'
   bool getEvent(sensors_event_t *);
        ^~~~~~~~
In file included from C:\Users\User\Documents\Arduino\Codes\BME280WeaStn230718\BME280WeaStn230718.ino:7:0:
C:\Users\User\Documents\Arduino\libraries\Adafruit_Sensor_master/Adafruit_Sensor.h:146:16: error:   overriding 'virtual void Adafruit_Sensor::getEvent(sensors_event_t*)'
   virtual void getEvent(sensors_event_t*);
                ^~~~~~~~
In file included from C:\Users\User\Documents\Arduino\Codes\BME280WeaStn230718\BME280WeaStn230718.ino:8:0:
C:\Users\User\Documents\Arduino\libraries\Adafruit_BME280_Library/Adafruit_BME280.h:130:8: error: conflicting return type specified for 'virtual bool Adafruit_BME280_Pressure::getEvent(sensors_event_t*)'
   bool getEvent(sensors_event_t *);
        ^~~~~~~~
In file included from C:\Users\User\Documents\Arduino\Codes\BME280WeaStn230718\BME280WeaStn230718.ino:7:0:
C:\Users\User\Documents\Arduino\libraries\Adafruit_Sensor_master/Adafruit_Sensor.h:146:16: error:   overriding 'virtual void Adafruit_Sensor::getEvent(sensors_event_t*)'
   virtual void getEvent(sensors_event_t*);
                ^~~~~~~~
In file included from C:\Users\User\Documents\Arduino\Codes\BME280WeaStn230718\BME280WeaStn230718.ino:8:0:
C:\Users\User\Documents\Arduino\libraries\Adafruit_BME280_Library/Adafruit_BME280.h:144:8: error: conflicting return type specified for 'virtual bool Adafruit_BME280_Humidity::getEvent(sensors_event_t*)'
   bool getEvent(sensors_event_t *);
        ^~~~~~~~
In file included from C:\Users\User\Documents\Arduino\Codes\BME280WeaStn230718\BME280WeaStn230718.ino:7:0:
C:\Users\User\Documents\Arduino\libraries\Adafruit_Sensor_master/Adafruit_Sensor.h:146:16: error:   overriding 'virtual void Adafruit_Sensor::getEvent(sensors_event_t*)'
   virtual void getEvent(sensors_event_t*);
                ^~~~~~~~
In file included from C:\Users\User\Documents\Arduino\Codes\BME280WeaStn230718\BME280WeaStn230718.ino:8:0:
C:\Users\User\Documents\Arduino\libraries\Adafruit_BME280_Library/Adafruit_BME280.h:218:45: error: 'TwoWire' has not been declared
   bool begin(uint8_t addr = BME280_ADDRESS, TwoWire *theWire = &Wire);
                                             ^~~~~~~
C:\Users\User\Documents\Arduino\libraries\Adafruit_BME280_Library/Adafruit_BME280.h:218:65: error: 'Wire' was not declared in this scope
   bool begin(uint8_t addr = BME280_ADDRESS, TwoWire *theWire = &Wire);
                                                                 ^~~~
C:\Users\User\Documents\Arduino\libraries\Adafruit_BME280_Library/Adafruit_BME280.h:218:65: note: suggested alternative: 'File'
   bool begin(uint8_t addr = BME280_ADDRESS, TwoWire *theWire = &Wire);
                                                                 ^~~~
                                                                 File
In file included from C:\Users\User\Documents\Arduino\Codes\BME280WeaStn230718\BME280WeaStn230718.ino:9:0:
C:\Users\User\Documents\Arduino\libraries\RTClib\src/RTClib.h:353:14: error: 'TwoWire' has not been declared
   bool begin(TwoWire *wireInstance = &Wire);
              ^~~~~~~
C:\Users\User\Documents\Arduino\libraries\RTClib\src/RTClib.h:353:39: error: 'Wire' was not declared in this scope
   bool begin(TwoWire *wireInstance = &Wire);
                                       ^~~~
C:\Users\User\Documents\Arduino\libraries\RTClib\src/RTClib.h:353:39: note: suggested alternative: 'File'
   bool begin(TwoWire *wireInstance = &Wire);
                                       ^~~~
                                       File
C:\Users\User\Documents\Arduino\libraries\RTClib\src/RTClib.h:372:14: error: 'TwoWire' has not been declared
   bool begin(TwoWire *wireInstance = &Wire);
              ^~~~~~~
C:\Users\User\Documents\Arduino\libraries\RTClib\src/RTClib.h:372:39: error: 'Wire' was not declared in this scope
   bool begin(TwoWire *wireInstance = &Wire);
                                       ^~~~
C:\Users\User\Documents\Arduino\libraries\RTClib\src/RTClib.h:372:39: note: suggested alternative: 'File'
   bool begin(TwoWire *wireInstance = &Wire);
                                       ^~~~
                                       File
C:\Users\User\Documents\Arduino\libraries\RTClib\src/RTClib.h:408:14: error: 'TwoWire' has not been declared
   bool begin(TwoWire *wireInstance = &Wire);
              ^~~~~~~
C:\Users\User\Documents\Arduino\libraries\RTClib\src/RTClib.h:408:39: error: 'Wire' was not declared in this scope
   bool begin(TwoWire *wireInstance = &Wire);
                                       ^~~~
C:\Users\User\Documents\Arduino\libraries\RTClib\src/RTClib.h:408:39: note: suggested alternative: 'File'
   bool begin(TwoWire *wireInstance = &Wire);
                                       ^~~~
                                       File
C:\Users\User\Documents\Arduino\libraries\RTClib\src/RTClib.h:435:14: error: 'TwoWire' has not been declared
   bool begin(TwoWire *wireInstance = &Wire);
              ^~~~~~~
C:\Users\User\Documents\Arduino\libraries\RTClib\src/RTClib.h:435:39: error: 'Wire' was not declared in this scope
   bool begin(TwoWire *wireInstance = &Wire);
                                       ^~~~
C:\Users\User\Documents\Arduino\libraries\RTClib\src/RTClib.h:435:39: note: suggested alternative: 'File'
   bool begin(TwoWire *wireInstance = &Wire);
                                       ^~~~
                                       File
In file included from C:\Users\User\Documents\Arduino\Codes\BME280WeaStn230718\BME280WeaStn230718.ino:11:0:
C:\Users\User\Documents\Arduino\libraries\TimeAlarms/TimeAlarms.h:71:31: error: 'timeDayOfWeek_t' does not name a type
   AlarmID_t alarmRepeat(const timeDayOfWeek_t DOW, const int H,  const int M,  const int S, OnTick_t onTickHandler); // as above, with day of week
                               ^~~~~~~~~~~~~~~
C:\Users\User\Documents\Arduino\libraries\TimeAlarms/TimeAlarms.h:75:29: error: 'timeDayOfWeek_t' does not name a type
   AlarmID_t alarmOnce(const timeDayOfWeek_t DOW, const int H,  const int M,  const int S, OnTick_t onTickHandler); // as above, with day of week
                             ^~~~~~~~~~~~~~~
C:\Users\User\Documents\Arduino\Codes\BME280WeaStn230718\BME280WeaStn230718.ino: In function 'void setup()':
C:\Users\User\Documents\Arduino\Codes\BME280WeaStn230718\BME280WeaStn230718.ino:87:22: error: call to 'bool Adafruit_BME280::begin(uint8_t, int*)' uses the default argument for parameter 2, which is not yet defined
   status = bme.begin();
                      ^
C:\Users\User\Documents\Arduino\Codes\BME280WeaStn230718\BME280WeaStn230718.ino:113:3: error: 'Wire' was not declared in this scope
   Wire.begin();
   ^~~~
C:\Users\User\Documents\Arduino\Codes\BME280WeaStn230718\BME280WeaStn230718.ino:113:3: note: suggested alternative: 'Dirn'
   Wire.begin();
   ^~~~
   Dirn
C:\Users\User\Documents\Arduino\Codes\BME280WeaStn230718\BME280WeaStn230718.ino:114:13: error: call to 'bool RTC_DS1307::begin(int*)' uses the default argument for parameter 1, which is not yet defined
   RTC.begin();
             ^
C:\Users\User\Documents\Arduino\Codes\BME280WeaStn230718\BME280WeaStn230718.ino:134:31: error: no matching function for call to 'SDClass::begin(int, int, int, int)'
   if (!SD.begin(10, 11, 12, 13))
                               ^
In file included from C:\Users\User\Documents\Arduino\Codes\BME280WeaStn230718\BME280WeaStn230718.ino:3:0:
C:\Users\User\Documents\Arduino\libraries\SD/SD.h:69:11: note: candidate: boolean SDClass::begin(uint8_t)
   boolean begin(uint8_t csPin = SD_CHIP_SELECT_PIN);
           ^~~~~
C:\Users\User\Documents\Arduino\libraries\SD/SD.h:69:11: note:   candidate expects 1 argument, 4 provided
C:\Users\User\Documents\Arduino\Codes\BME280WeaStn230718\BME280WeaStn230718.ino:218:10: error: 'minute' was not declared in this scope
   while (minute() != 0) //Prog holds here until the hour so that logging is on the hour and the half hour.
          ^~~~~~
C:\Users\User\Documents\Arduino\Codes\BME280WeaStn230718\BME280WeaStn230718.ino:218:10: note: suggested alternative: 'minTy'
   while (minute() != 0) //Prog holds here until the hour so that logging is on the hour and the half hour.
          ^~~~~~
          minTy
C:\Users\User\Documents\Arduino\Codes\BME280WeaStn230718\BME280WeaStn230718.ino:224:18: error: 'minute' was not declared in this scope
   Serial.println(minute(), DEC);
                  ^~~~~~
C:\Users\User\Documents\Arduino\Codes\BME280WeaStn230718\BME280WeaStn230718.ino:224:18: note: suggested alternative: 'minTy'
   Serial.println(minute(), DEC);
                  ^~~~~~
                  minTy
C:\Users\User\Documents\Arduino\Codes\BME280WeaStn230718\BME280WeaStn230718.ino: In function 'void Repeat2()':
C:\Users\User\Documents\Arduino\Codes\BME280WeaStn230718\BME280WeaStn230718.ino:328:9: error: 'minute' was not declared in this scope
  */ if (minute() == 0) {
         ^~~~~~
C:\Users\User\Documents\Arduino\Codes\BME280WeaStn230718\BME280WeaStn230718.ino:328:9: note: suggested alternative: 'minTy'
  */ if (minute() == 0) {
         ^~~~~~
         minTy
Multiple libraries were found for "PinChangeInt.h"
  Used: C:\Users\User\Documents\Arduino\Libraries\PinChangeInt
  Not used: C:\Users\User\Documents\Arduino\Libraries\PinChangeInt_master
Multiple libraries were found for "Adafruit_MCP23017.h"
  Used: C:\Users\User\Documents\Arduino\Libraries\Adafruit_MCP23017_Arduino_Library_master
  Not used: C:\Users\User\Documents\Arduino\Libraries\Adafruit_RGB_LCD_Shield_Library_master
Multiple libraries were found for "SD.h"
  Used: C:\Users\User\Documents\Arduino\Libraries\SD
  Not used: C:\Users\User\AppData\Local\Arduino15\libraries\SD
  Not used: C:\Users\User\Documents\Arduino\Libraries\SD_master
Multiple libraries were found for "SPI.h"
  Used: C:\Users\User\Documents\Arduino\Libraries\SPI
  Not used: C:\Users\User\Documents\Arduino\Libraries\SPI_master
Multiple libraries were found for "Adafruit_Sensor.h"
  Used: C:\Users\User\Documents\Arduino\Libraries\Adafruit_Sensor_master
  Not used: C:\Users\User\Documents\Arduino\Libraries\Adafruit_Unified_Sensor
exit status 1

Compilation error: call to 'bool Adafruit_BME280::begin(uint8_t, int*)' uses the default argument for parameter 2, which is not yet defined

the wire library is part of the Arduino IDE libraries - no need to instal it

deleted my arduino/libraries folder and compiled you code from post 4
installed libraries to suit - some names appear to have changed
the headers now look like

#include <avr/wdt.h>
#include <SD.h>
#include <Wire.h>
#include <SPI.h>
#include <Adafruit_MCP23X17.h>  //<< changed name
//#include <Adafruit_Sensor.h>  // << library not found
#include <Adafruit_BME280.h>    // install
#include <RTClib.h>             // install
#include <Time.h>
#include <TimeAlarms.h>         // install
#include <Adafruit_RGBLCDShield.h>  // download ZIP from https://github.com/adafruit/Adafruit-RGB-LCD-Shield-Library
#include <PinChangeInterrupt.h>   // name changed
#define PIN 3  // the pin for button/ rain gauge
#define STOP_SWITCH 2

and the error messages are now

C:\Users\bb\AppData\Local\Temp\.arduinoIDE-unsaved2023627-4224-18i7954.owv8\sketch_jul27b\sketch_jul27b.ino: In function 'void setup()':
C:\Users\bb\AppData\Local\Temp\.arduinoIDE-unsaved2023627-4224-18i7954.owv8\sketch_jul27b\sketch_jul27b.ino:133:31: error: no matching function for call to 'SDLib::SDClass::begin(int, int, int, int)'
   if (!SD.begin(10, 11, 12, 13))
                               ^
In file included from C:\Users\bb\AppData\Local\Temp\.arduinoIDE-unsaved2023627-4224-18i7954.owv8\sketch_jul27b\sketch_jul27b.ino:2:0:
C:\Users\bb\AppData\Local\Arduino15\libraries\SD\src/SD.h:71:15: note: candidate: boolean SDLib::SDClass::begin(uint8_t)
       boolean begin(uint8_t csPin = SD_CHIP_SELECT_PIN);
               ^~~~~
C:\Users\bb\AppData\Local\Arduino15\libraries\SD\src/SD.h:71:15: note:   candidate expects 1 argument, 4 provided
C:\Users\bb\AppData\Local\Arduino15\libraries\SD\src/SD.h:72:15: note: candidate: boolean SDLib::SDClass::begin(uint32_t, uint8_t)
       boolean begin(uint32_t clock, uint8_t csPin);
               ^~~~~
C:\Users\bb\AppData\Local\Arduino15\libraries\SD\src/SD.h:72:15: note:   candidate expects 2 arguments, 4 provided

exit status 1

Compilation error: no matching function for call to 'SDLib::SDClass::begin(int, int, int, int)'

propably due to library name changes in the SD libraryetc

Thank you. Where did you find ```
<Adafruit_MCP23X17.h>

use the library manager to instal Adafruit_MCP23017 but the include is Adafruit_MCP23X17 - hod to look at examples to find this

Thanks. Will try again tomorrw.