Thanks for sharing,
one remark: void setPin(int outputPin) could be
void setPin(uint8_t outputPin) // use smallest datatype possible
// function to select pin on 74HC4067
{
PORTD = controlPins[outputPin] | (PORTD & 0x0F); // keep the state of the lower 4 pins.
}
or without controlPins array
void setPin(uint8_t outputPin) // use smallest datatype possible
// function to select pin on 74HC4067
{
PORTD = (outputPin << 4) | (PORTD & 0x0F); // keep the state of the lower 4 pins.
}