Hi!
I am using a Mux Shield II ( Mux Shield II | Mayhew Labs ) with an Arduino Mega 2560 to get a signal from a pressure sensor using this scheme (but with the signal in the port 15 of the I/O 3 of my mux shield)
But when I press the sensor, instead of getting the value of just one I/O port, I am getting all these values:
Here the example code I am using (modified to show only the I/O3) values:
#include <MuxShield.h>
//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 IO3 values for inspection
//Serial.print("IO3 analog values: ");
for (int i=0; i<16; i++)
{
Serial.print(IO3AnalogVals[i]);
Serial.print('\t');
}
Serial.println();
}
Also, this 'noise' occurs in the all other I/O1 and I/O2 ports.
Does someone had any problem like this?
Thank you!