Multiple IMU's with Multiplexer

Hello guys i really need help.
I was working on a project that uses two Gy-85 IMU's with a multiplexer and arduino.
My old Code using gy-85 library is working properly.
But this code was only giving me the angles of each sensor. Now i decided to use the the Razor AHRS code but i can't make it work using multiple IMU's. ( I need Only 2 IMU's).
The Multiplexer i am using is CD74HC4067.
All codes are posted here.
Please Help ASAP.
RAZOR AHRS Code: GitHub - Razor-AHRS/razor-9dof-ahrs: AHRS Firmware for the SparkFun 9DOF Razor IMU and SparkFun 9DOF Sensor Stick
Multiplexer Code : bildr Muxing Around With The CD74HC4067 + Arduino - bildr

Post code here in the forum. We don't get code from bildr.org or any other site with temporary storage.

// MUX CODE
int s0 = 8;
int s1 = 9;
int s2 = 10;
int s3 = 11;

//Mux in “SIG” pin
int SIG_pin = 0;

void setup(){
pinMode(s0, OUTPUT);
pinMode(s1, OUTPUT);
pinMode(s2, OUTPUT);
pinMode(s3, OUTPUT);

digitalWrite(s0, LOW);
digitalWrite(s1, LOW);
digitalWrite(s2, LOW);
digitalWrite(s3, LOW);

Serial.begin(9600);
}

void loop(){

//Loop through and read all 16 values
//Reports back Value at channel 6 is: 346
for(int i = 0; i < 16; i ++){ Serial.print("Value at channel "); Serial.print(i); Serial.print("is : "); Serial.println(readMux(i)); delay(1000); } } int readMux(int channel){ int controlPin = {s0, s1, s2, s3}; int muxChannel[16][4]={ {0,0,0,0}, //channel 0 {1,0,0,0}, //channel 1 {0,1,0,0}, //channel 2 {1,1,0,0}, //channel 3 {0,0,1,0}, //channel 4 {1,0,1,0}, //channel 5 {0,1,1,0}, //channel 6 {1,1,1,0}, //channel 7 {0,0,0,1}, //channel 8 {1,0,0,1}, //channel 9 {0,1,0,1}, //channel 10 {1,1,0,1}, //channel 11 {0,0,1,1}, //channel 12 {1,0,1,1}, //channel 13 {0,1,1,1}, //channel 14 {1,1,1,1} //channel 15 }; //loop through the 4 sig for(int i = 0; i < 4; i ++){ digitalWrite(controlPin, muxChannel[channel]); } //read the value at the SIG pin int val = analogRead(SIG_pin); //return the value return val; }

What a mess!

Please format the code properly and post it using code tags, as described in "How to use this forum".

// MUX CODE
int s0 = 8;
int s1 = 9;
int s2 = 10;
int s3 = 11;

//Mux in "SIG" pin
int SIG_pin = 0;

void setup(){
pinMode(s0, OUTPUT);
pinMode(s1, OUTPUT);
pinMode(s2, OUTPUT);
pinMode(s3, OUTPUT);

digitalWrite(s0, LOW);
digitalWrite(s1, LOW);
digitalWrite(s2, LOW);
digitalWrite(s3, LOW);

Serial.begin(9600);
}

void loop(){

//Loop through and read all 16 values
//Reports back Value at channel 6 is: 346
for(int i = 0; i < 16; i ++){
 Serial.print("Value at channel ");
 Serial.print(i); Serial.print("is : ");
 Serial.println(readMux(i)); delay(1000);
 }
 }
 int readMux(int channel)
 {
 int controlPin[] = {s0, s1, s2, s3};
 int muxChannel[16][4]={ {0,0,0,0}, //channel 0
 {1,0,0,0}, //channel 1 {0,1,0,0},
 //channel 2 {1,1,0,0},
 //channel 3 {0,0,1,0},
 //channel 4 {1,0,1,0},
 //channel 5 {0,1,1,0},
 //channel 6 {1,1,1,0},
 //channel 7 {0,0,0,1},
 //channel 8 {1,0,0,1},
 //channel 9 {0,1,0,1},
 //channel 10 {1,1,0,1},
 //channel 11 {0,0,1,1},
 //channel 12 {1,0,1,1}, 
 //channel 13 {0,1,1,1},
 //channel 14 {1,1,1,1} 
 //channel 15 };
 //loop through the 4 sig 
 for(int i = 0; i < 4; i ++)
 {
 digitalWrite(controlPin, muxChannel[channel]); 
 }
 //read the value at the SIG pin
 int val = analogRead(SIG_pin); 
 //return the value 
 return val; }

That code doesn't compile (and it's still horribly formatted). Do you know the Auto Format tool in the IDE?

The comments and array initialization data are not properly formatted, which is one reason it won't compile.

  int muxChannel[16][4] = { {0, 0, 0, 0}, //channel 0
    {1, 0, 0, 0}, //channel 1 {0,1,0,0},

i want to merge the 2 codes from github and the one i posted