hi,
i am using the example codes for input.
when using the digital input, i put 5V to pin #4 but when i display it i got '1' on pins #4. when i put 5V to pin#1 i got '1' on pins #1 to #10.
the same problem i got on the analog input. i put 5V to one pin and i get 1024 on many other pins.
hi, i am using Arduino mega and i got the same problem on Arduino Uno.
The MUX SHIELD II can be found here Mux Shield II | Mayhew Labs
this is my code
//This example shows how to use the Mux Shield for digital inputs
#include <MuxShield.h>
//Initialize the Mux Shield
MuxShield muxShield;
void setup()
{
//Set IO1, IO2, and IO3 as digital inputs
muxShield.setMode(1,DIGITAL_IN);
//use DIGITAL_IN in place of DIGITAL_IN_PULLUP if internal pullups are not needed
muxShield.setMode(2,DIGITAL_IN);
muxShield.setMode(3,DIGITAL_IN);
Serial.begin(9600);
}
//Arrays to store digital values
int IO1DigitalVals[16];
int IO2DigitalVals[16];
int IO3DigitalVals[16];
void loop()
{
for (int i=0; i<16; i++)
{
//Digital read on all 16 inputs on IO1, IO2, and IO3
IO1DigitalVals[i] = muxShield.digitalReadMS(1,i);
// IO2DigitalVals[i] = muxShield.digitalReadMS(2,i);
// IO3DigitalVals[i] = muxShield.digitalReadMS(3,i);
}
//Print IO 1 values for inspection
Serial.print("IO1 analog values: ");
for (int i=0; i<16; i++)
{
Serial.print(IO1DigitalVals[i]);
}
Serial.println();
delay(5000);
}
I connect pin 3 on I/O row 1 (on the mux shield) to 5V and i got this print
Hi,
When you have digital input pins, you have to have either gnd or 5V on them, if the input is open then it is termed floating so it can have any value.
From what I can see in the documentation there are no pullup or pulldown resistors.
Use 10K on each input so that they are at a logic level 5V or gnd when not being used.
If you are using a simple switch/press button on an input, between input and 5V, then connect a 10K from input to gnd so the input will go to gnd when the switch is open.