const int ImuxSIG = 7;
const int ImuxS0 = 11;
const int ImuxS1 = 10;
const int ImuxS2 = 9;
const int ImuxS3 = 8;
const int OmuxSIG = 2;
const int OmuxS0 = 6;
const int OmuxS1 = 5;
const int OmuxS2 = 4;
const int OmuxS3 = 3;

int SetMuxChannelI(byte channel) {
  digitalWrite(ImuxS0, bitRead(channel, 0));
  digitalWrite(ImuxS1, bitRead(channel, 1));
  digitalWrite(ImuxS2, bitRead(channel, 2));
  digitalWrite(ImuxS3, bitRead(channel, 3));
}

int SetMuxChannelO(byte channel) {
  digitalWrite(OmuxS0, bitRead(channel, 0));
  digitalWrite(OmuxS1, bitRead(channel, 1));
  digitalWrite(OmuxS2, bitRead(channel, 2));
  digitalWrite(OmuxS3, bitRead(channel, 3));
}

void setup() {
  pinMode(ImuxSIG, OUTPUT);
  pinMode(ImuxS0, OUTPUT);
  pinMode(ImuxS1, OUTPUT);
  pinMode(ImuxS2, OUTPUT);
  pinMode(ImuxS3, OUTPUT);
  pinMode(OmuxS0, OUTPUT);
  pinMode(OmuxS1, OUTPUT);
  pinMode(OmuxS2, OUTPUT);
  pinMode(OmuxS3, OUTPUT);
}

void loop() {
  for (byte i = 0; i < 16; i++) {
    SetMuxChannelI(i);
    digitalWrite(ImuxSIG, HIGH);
    //delay(200);
    digitalWrite(ImuxSIG, LOW);
    //delay(200);
  }

  for (byte i = 0; i < 16; i++) {
    SetMuxChannelO(i);
    byte muxValue = analogRead(OmuxSIG);

    Serial.print(muxValue);
    Serial.print("\t");
  }
}
nano:12
nano:11
nano:10
nano:9
nano:8
nano:7
nano:6
nano:5
nano:4
nano:3
nano:2
nano:GND.2
nano:RESET.2
nano:0
nano:1
nano:13
nano:3.3V
nano:AREF
nano:A0
nano:A1
nano:A2
nano:A3
nano:A4
nano:A5
nano:A6
nano:A7
nano:5V
nano:RESET
nano:GND.1
nano:VIN
nano:12.2
nano:5V.2
nano:13.2
nano:11.2
nano:RESET.3
nano:GND.3
mux1:I15
mux1:I14
mux1:I13
mux1:I12
mux1:I11
mux1:I10
mux1:I9
mux1:I8
mux1:I7
mux1:I6
mux1:I5
mux1:I4
mux1:I3
mux1:I2
mux1:I1
mux1:I0
mux1:COM
mux1:S3
mux1:S2
mux1:S1
mux1:S0
mux1:EN
mux1:VCC
mux1:GND
mux2:I15
mux2:I14
mux2:I13
mux2:I12
mux2:I11
mux2:I10
mux2:I9
mux2:I8
mux2:I7
mux2:I6
mux2:I5
mux2:I4
mux2:I3
mux2:I2
mux2:I1
mux2:I0
mux2:COM
mux2:S3
mux2:S2
mux2:S1
mux2:S0
mux2:EN
mux2:VCC
mux2:GND
sw1:1a
sw1:2a
sw1:3a
sw1:4a
sw1:5a
sw1:6a
sw1:7a
sw1:8a
sw1:8b
sw1:7b
sw1:6b
sw1:5b
sw1:4b
sw1:3b
sw1:2b
sw1:1b
sw2:1a
sw2:2a
sw2:3a
sw2:4a
sw2:5a
sw2:6a
sw2:7a
sw2:8a
sw2:8b
sw2:7b
sw2:6b
sw2:5b
sw2:4b
sw2:3b
sw2:2b
sw2:1b
bargraph1:A1
bargraph1:A2
bargraph1:A3
bargraph1:A4
bargraph1:A5
bargraph1:A6
bargraph1:A7
bargraph1:A8
bargraph1:A9
bargraph1:A10
bargraph1:C1
bargraph1:C2
bargraph1:C3
bargraph1:C4
bargraph1:C5
bargraph1:C6
bargraph1:C7
bargraph1:C8
bargraph1:C9
bargraph1:C10
bargraph2:A1
bargraph2:A2
bargraph2:A3
bargraph2:A4
bargraph2:A5
bargraph2:A6
bargraph2:A7
bargraph2:A8
bargraph2:A9
bargraph2:A10
bargraph2:C1
bargraph2:C2
bargraph2:C3
bargraph2:C4
bargraph2:C5
bargraph2:C6
bargraph2:C7
bargraph2:C8
bargraph2:C9
bargraph2:C10
led1:A
led1:C