
Our working MUX test set up.
Thhhhhis was a pain in the nutz.
Thanks Tom, Tymm, and Todd for all the help!!!
int val[16];
int a= 3; // SELECT PIN A0 GOING INTO PIN 2
int b= 4; // SELECT PIN A1 GOING INTO PIN 3
int c= 5; // SELECT PIN A2 GOING INTO PIN 4 //variables in this code have been changed from their original value of Int to byte.
int d= 6; // SELECT PIN A3 GOING INTO PIN 5
int analog0 = 0;
void setup() {
Serial.begin(9600);
pinMode(analog0, INPUT);
pinMode(a,OUTPUT);
pinMode(b,OUTPUT);
pinMode(c,OUTPUT);
pinMode(d,OUTPUT);
}
void loop() {
for (int channelNum = 0; channelNum > 1) ;
// shift value 2 bits to the right, and mask all but bit 0:
int pinThree = 1 & (channelNum >> 2);
// shift value 3 bits to the right, and mask all but bit 0:
int pinFour = 1 & (channelNum >> 3);
// set the address pins:
digitalWrite(a,pinOne);
digitalWrite(b,pinTwo);
digitalWrite(c,pinThree);
digitalWrite(d,pinFour);
// read the analog input and store it in the value array:
val[channelNum] = analogRead(analog0);
// print the values as a single tab-separated line:
Serial.print(val[channelNum], DEC);
Serial.print(”\t”);
}
// print a carriage return at the end of each read of the mux:
Serial.println();
}
This is a close up of our wiring. Note the resistors: Without them, you get wicked, confusing, channel bleed that will lead to you speaking in ones and zeros for days.

I just noticed that there is actually one loose wire in this shot. The orange wire, from the arduino to the breadboard, to the right of the chip in the bottom left of the photo, should be plugged into row 29, directly above the green wire. We also got ride of the diodes on the power line into the MUX, as they turned out to be unnecessary.
I’ll try and get a proper wiring diagram up when i have time.
If your code and set up works, you’ll get a print in Arduino that looks something like the shot below
, except with analog values where the 0’s are.