Master to slave, slave to I2C peripheral

nmd89:
Here's my setup:

I have a master arduino (using a Pro Mini 5V) and it addresses a slave. What I want the slave to do is read four pressure sensors and get IMU data from an MPU9250. I want to be able to have the master talk to the slave and the slave talk to the IMU all on the same I2C bus. The problem comes after the master talks to the slave. The slave then wants to talk to the IMU, but the clock signal (SCL) disappears because it is generated by the master not the slave. I tried to use a switch that would disconnect the master SDA line from the slave SDA line and connect the slave SDA line to the IMU SDA line.

Here's the Master code:

byte Buf[14];

byte Mag[6];
byte pressure[8];

void loop()
{
 //Serial.print("hey");
 Wire.requestFrom(8, 8);
 
 if(!Wire.available())
   {
     Serial.print("wire not available");
   }
 while(Wire.available())
 {
       
   for(int i=0; i<sizeof(Buf); i++)
   {
     Buf[i] = Wire.read();
   }
   
   for(int i=0; i<sizeof(Mag); i++)
   {
     Mag[i] = Wire.read();
   }
   
   for(int i=0; i<sizeof(pressure); i++)
   {
     pressure[i] = Wire.read();
   }
   
 }

Looking at just the first part of the master's loop() has me concerned.

You are requesting 8 bytes from slave 8? and then you are reading 28 bytes?

The while() loop is only ever executed once.

I think you need to describe how your program should work, then translate this description to code.

Does the slave package 28 bytes to send to the master at once? Or do you want to do 3 reads?

#define BUFSIZE 14
#define MAGSIZE 6
#define PRESSURESIZE 8

// I dislike having multiple instances of constants,  I usually mis-type  one and it take forever to find it!

byte Buf[BUFSIZE];
byte Mag[MAGSIZE];
byte pressure[PRESSURESIZE];

#define BLOCKSIZE 28

void loop() 
int i;
int count=Wire.requestFrom(8,BLOCKSIZE); 
if(count == BLOCKSIZE) { // got a good block
  for(i=0;i<BUFSIZE; i++){
    Buf[i]=Wire.read();
    }
  for(i=0;i<MAGSIZE; i++){
    Mag[i]=Wire.read();
    }
  for(i=0;i<PRESSURESIZE; i++){
    pressure[i]=Wire.read();
    }
  }
else { // bad block, skip
  Serial.print("badBlock length=");
  Serial.print(count,DEC);
  }
}

Chuck.