Arduino Uno with Ethernet shield + micro SD (weather station)

I am trying to build a weather station with these components:

  1. BMP280 barometric sensor (Temperature… Pressure… Humidity)
  2. Arduino Uno
  3. 50K potentiometer

I wrote/modified the code below and I could only achieve these:
A

  1. I get the barometric reading of my room alright.
  2. I display a hard coded string on the LCD display

However I will like to achieve:
B

  1. I get the barometric reading of my room alright.
  2. I display a hard coded string (name) on the LCD display
  3. Write the reading to the SD card object
  4. Read the the SD card object and display it on the LCD screen
  5. Alternate display of the name (250 ms) and barometric info (temperature, Pressure, Humidity) on SD card (500 ms)
//LCD1602
//You should now see your LCD1602 display the flowing characters "SUNFOUNDER" and "hello, world"
//Email:support@sunfounder.com
//Website:www.sunfounder.com
//2015.5.7 
#include <SD.h> //Load SD card library
#include<SPI.h> //Load SPI Library
#include<Wire.h>
#include "SparkFunBME280.h"
#include <LiquidCrystal.h>// include the library code

//File mySensorData;              //File object to write data to
/**********************************************************/
BME280 mySensorA; //Uses default I2C address 0x77
BME280 mySensorB; //Uses I2C address 0x76 (jumper closed)
/**********************************************************/
char array1[]=" Simpx, Inc               ";  //the string to print on the LCD
char array2[]="Lync Platform!             ";  //the string to print on the LCD
int tim = 500;  //the value of delay time
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(4, 6, 10, 11, 12, 13);
/*********************************************************/
void setup()
{
 //Write Headers to micro SD object in file <name.*>
 /************************************************************/ 
   /*{ 
   const int chipSelect = 8;        //Maybe not yours!!.You have to put your cs pin here
   pinMode(8, OUTPUT);
   SD.begin(chipSelect);
   mySensorData = SD.open("PTHData.txt", FILE_WRITE); //it is asking to open PTHData.txt
   mySensorData.println("        Temperature,        Pressure,         Humidity" );
   mySensorData.close();
   
   }*/
  /************************************************************/

   lcd.begin(16, 2);  // set up the LCD's number of columns and rows: 
  
   Serial.begin(9600);
   Serial.println("Example showing alternate I2C addresses");

   Wire.begin();

   mySensorA.setI2CAddress(0x76); //The default for the SparkFun Environmental Combo board is 0x77 (jumper open).
  //If you close the jumper it is 0x76
  //The I2C address must be set before .begin() otherwise the cal values will fail to load.

   if(mySensorA.beginI2C() == false) Serial.println("Sensor A connect failed");

   mySensorB.setI2CAddress(0x76); //Connect to a second sensor
   if(mySensorB.beginI2C() == false) Serial.println("Sensor B connect failed");
}
/*********************************************************/
void loop() 
{
    lcd.setCursor(15,0);  // set the cursor to column 15, line 0
    for ( int positionCounter1 = 0; positionCounter1 < 26; positionCounter1++)
    {
      lcd.scrollDisplayLeft();  //Scrolls the contents of the display one space to the left.
      lcd.print(array1[positionCounter1]);  // Print a message to the LCD.
      delay(tim);  //wait for 250 microseconds
    }
    lcd.clear();  //Clears the LCD screen and positions the cursor in the upper-left corner.
    lcd.setCursor(15,1);  // set the cursor to column 15, line 1
    for (int positionCounter2 = 0; positionCounter2 < 26; positionCounter2++)
    {
      lcd.scrollDisplayLeft();  //Scrolls the contents of the display one space to the left.
      lcd.print(array2[positionCounter2]);  // Print a message to the LCD.
      delay(tim);  //wait for 250 microseconds
    }
    lcd.clear();  //Clears the LCD screen and positions the cursor in the upper-left corner.
    
      Serial.print("HumidityA: ");
      Serial.print(mySensorA.readFloatHumidity(), 0);

      Serial.print(" PressureA: ");
      Serial.print(mySensorA.readFloatPressure(), 0);

      Serial.print(" TempA: ");
      //Serial.print(mySensorA.readTempC(), 2);
      Serial.print(mySensorA.readTempF(), 2);

      Serial.print(" Humidity Room: ");
      Serial.print(mySensorB.readFloatHumidity(), 0);
      Serial.print("%");
      
      Serial.print(" Pressure Room: ");
      Serial.print(mySensorB.readFloatPressure(), 0);
      Serial.print(" Pa ");

      Serial.print(" Temperatur Room: ");
      //Serial.print(mySensorB.readTempC(), 2);
      Serial.print(mySensorB.readTempF(), 2);
      Serial.print( " degrees F ");

      Serial.println();

      delay(100);

    /* {
     mySensorData = SD.open("PTHData.txt", FILE_WRITE);
     float tempR = mySensorB.readTempF();
     float presR = mySensorB.readFloatPressure();
     float humdR = mySensorB.readFloatHumidity();     
*********Make sure the righ object writes the right values*******     
       if(mySensorData) {
      mySensorData.print(tempR);                            //write temperature data to card
      mySensorData.print(",");                              //write a commma
      mySensorData.print(presR);                            //write pressure and end the line (println)
      mySensorData.print(",");                               //write a commma
      mySensorData.println(humdR);                           //write temperature data to card
      mySensorData.print(",");                               //write a comma
      mySensorData.close();
      delay(500); 
       }*/                
}

Right now this code will give you a solution for:
A1
A2

FYI
When I un-comment these lines of code I get A1 as solution and nothing was written to micro SD object. I failed woefully to achieve my goal. Any help will be appreciated thanks.

The SPI interface is on pins 10, 11, 12, and 13. Don’t use those for the LCD.

The “Slave Select” for the SD card on the Ethernet shield is Pin 4. Don’t use Pin 4 for the LCD.

If you are not using the Ethernet interface, set Pin 10 as an OUTPUT and set it HIGH. That is the Slave Select for the Ethernet adapter.

If you run out of regular digital pins, you can use A0-A5 (the analog input pins) as digital I/O pins. Or you can get an I2C LCD, change libraries, and use A4 and A5 (the I2C pins) to control the LCD.

Does this mean that my sketch for what I want to achieve fine but the SPI connection needs work?

By this I am referring to the non-commented version of the sketch.

How can I connect the LCD and sensor with respect to the MCU master status and the two slaves (peripherals)?

Some confusion arises now so let me say these. I am not sure of each of the slave selects needed or

how to connect them?

This means I have to tear the whole thing down and rearrange things.

Where do I start? Maybe I should start from this one:

What Pin can I use for sensor(barometric) and LCD slave select....?

Thanks mate you made my day.... I really appreciate your help.

The LCD needs 6 digital pins. It does not use SPI.

The SD card uses SPI (10, 11, 12, and 13) and a Slave Select pin (4).

The pressure sensor uses Wire/TWI/I2C (A4, and A5).

Start with a list of pins and mark the ones you can't move:

0 (Serial)
1 (Serial)
2
3
4 SD Card SlaveSelect
5
6
7
8
9
10 (SPI) Ethernet SlaveSelect
11 (SPI) Ethernet and SD Card
12 (SPI) Ethernet and SD Card
13 (SPI) Ethernet and SD Card
A0
A1
A2
A3
A4 (Wire/TWI/I2C) pressure sensor
A5 (Wire/TWI/I2C) pressure sensor

That leave you with a list of pins you can use for other stuff:
2
3
5
6
7
8
9
A0
A1
A2
A3

Pick any 6 for the LCD.