Connecting the cathode of a diode to the output of a multiplexer
The code you have posted should loop through the 8 possible MUX in/out pins (Y0...Y7) connecting one at a time to pin 3.
Assuming your Y0 through Y7 are each connected to a pin on your &quot;do something&quot; block, the mux should connect each of the 7 pins on your &quot;do something&quot; to Z.
One problem I see is that your code changes the pin select values on the MUX while the MUX is enabled. As you execute your for(int i=0;i&lt;3;i++) loop and toggle the different select bits to S0...S2, the MUX will connect different Y0...Y7 pins to Z, until it settles on the final set of values for S0...S2. You should really set inhibit_pin to HIGH (disabling the mux before entering your for(int i=0;i&lt;3;i++) loop, and then set it to LOW again at the end of the i loop and before the delay. (to re-enable the MUX at the now-completely-selected pin.)
Your description is a little hard to follow, but it sounds like that is what you want.
If you want each pin to be connected for 3 seconds, then not connected to any pin for .1 seconds before moving on to the next pin, you might rewrite your loop like this:
void loop() {
  // looping through all 8 LEDs
  for (int j=0;j&lt;8;j++){

    // disable the mux while selecting a pin
    digitalWrite(inhibit_pin,HIGH); 

    // select a MUX pin
    for(int i=0;i&lt;3;i++){
      digitalWrite(outputs[i],bitRead(j,i));
    }
    // re-enable the mux now that we've selected a pin
    digitalWrite(inhibit_pin,LOW);
 
    delay(3000); // leave the pin active for 3 seconds.

    // disable the mux for .1 seconds
    digitalWrite(inhibit_pin,HIGH); 
    delay(100); 
  }
}