class CD74HC4067 {
  private:
    const char * nom;
    const byte select[4];
    const byte com;

  public:
    int analogCache[16];

    CD74HC4067(const char* nom, const byte s0, const byte s1, const byte s2, const byte s3, const byte com) :
      nom(nom), select{s0, s1, s2, s3}, com(com) {
      for (byte canal = 0; canal < 16; canal ++) analogCache[canal] = -1;
    }

    void begin() {
      for (const byte p : select) pinMode(p, OUTPUT);
      pinMode(com, INPUT);
    }

    int analogRead(const byte canal, const bool doubleRead = true) {
      if (canal > 15) return -1;
      for (byte i = 0; i < 4; i++) digitalWrite(select[i], bitRead(canal, i));
      if (doubleRead) analogRead(com);
      return analogRead(com);
    }

    void updateAnalogCache(const bool doubleRead = true) {
      for (byte canal = 0; canal < 16; canal++) analogCache[canal] = analogRead(canal, doubleRead);
    }
};

CD74HC4067 mux[] = {
  {"MUX1", 7, 6, 5, 4, A1},
  {"MUX2", 11, 10, 9, 8, A0}
};

void setup() {
  for (auto& m : mux) m.begin();
  Serial.begin(115200);

  unsigned long t0 = micros();
  for (auto& m : mux) m.updateAnalogCache();
  unsigned long deltaT = micros() - t0;

  Serial.print("Lecture de 32 entrées analogiques ∆t = ");
  Serial.print(deltaT);
  Serial.print(" µs.");
}

void loop() {}