I got a Mux Shield II: Mux Shield II | Mayhew Labs
I uploaded the analog in example code:
//This example shows how to use the Mux Shield for analog inputs
#include <MuxShield.h>
//Initialize the Mux Shield
MuxShield muxShield;
void setup()
{
//Set I/O 1, I/O 2, and I/O 3 as analog inputs
muxShield.setMode(1,ANALOG_IN);
muxShield.setMode(2,ANALOG_IN);
muxShield.setMode(3,ANALOG_IN);
Serial.begin(9600);
}
//Arrays to store analog values after recieving them
int IO1AnalogVals[16];
int IO2AnalogVals[16];
int IO3AnalogVals[16];
void loop()
{
for (int i=0; i<16; i++)
{
//Analog read on all 16 inputs on IO1, IO2, and IO3
IO1AnalogVals[i] = muxShield.analogReadMS(1,i);
IO2AnalogVals[i] = muxShield.analogReadMS(2,i);
IO3AnalogVals[i] = muxShield.analogReadMS(3,i);
}
//Print IO1 values for inspection
Serial.print("IO1 analog values: ");
for (int i=0; i<16; i++)
{
Serial.print(IO1AnalogVals[i]);
Serial.print('\t');
}
Serial.println();
}
When I connect a photoresistor to the IO1 row in pin zero and cover the photoresistor, the readings for the whole IO1 row change with it. Is there any way to stop this from happening?
Another problem, when I attach two photoresistors to the shield, in pins zero and one, for example, the readings only change for the photoresistor in pin zero and not in one. Why might this be?
Thanks,
Tim