// change S0..S3 to the actual pins you use
// make sure they are least significant bit to most significant bit (S0 to S3)
const int addressPins = { S0, S1, S2, S3 };
const int analogPin = X; // set to whatever pin you connect to
int analogValue[16];
void readAllChannels() {
for ( int ch = 0; ch < 16; ++ch ) {
for ( int i = 0; i < 4; ++i ) {
digitalWrite( addressPins[i], bitRead( ch, i ) ); // set the address lines
}
analogValue[ch] = analogRead(analogPin);
}
}