I am a newbie in Arduino and in all about this and I would like to use Muxshield II with Arduino MEGA.
if I connect this parts as on the image - it's all? I can connect sensors on this pins and it will be to function?
Thank you very much
if I connect this parts as on the image - it's all?
I can connect sensors on this pins and it will be to function?
If you write the code correctly, yes.
Ok, so If I use this schema where R is resistor and S are reed sensors - it´s right yes?
I connect pin on the 3th row on pin 14 and 15.
And I use a program (from examples for muxshield):
//This example shows how to use the Mux Shield for digital inputs
//Initialize the Mux Shield
//Array to store digital values
for (int i=0; i<16; i++)
IO3DigitalVals[i] = muxShield.digitalReadMS(3,i);
//Print IO 1 values for inspection
Serial.print("IO3 digital values: ");
for (int i=0; i<16; i++)
I will get a values from 0 to 15 - 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 ? This is good result?
Because I connect app. 30 reed switches and if I try to put a magnet on one reed switch.. a many from this pins return 1 and I don´t know why. So this is a reason why I start ask if I have good connection of muxshield - because when I try to turn on one reed switch, always are another changed.
Because I connect app. 30 reed switches and if I try to put a magnet on one reed switch
How far apart are the reed switches? Is the magnet triggering more than one of them?
No it is not possible - reed switches are very far approximatly 30 mm and magnet - which I try to reed switch is very small. A lot of pins are changed from 0 to 1 - but connection is Ok? This is first thing what I need to know
You have the mode set as DIGITAL_INPUT_PULLUP. Because of that (and that's the way you do want to do it) I believe you want to have the resistor in your diagram connected to GND instead of 5V.
Setting the pull-up, which is like connecting a 20K resistor between 5V and the input pin, causes the pin to read as high when the reed switch is open. When the reed switch closes and completes a circuit to GND it will then read low. You can read up on https://www.arduino.cc/en/Tutorial/DigitalPins to understand what's going on here.
I've never touched the Muxshield so this is mostly an educated guess.
When you use DIGITAL_IN_PULLUP you should connect each reed switch between its input pin and GROUND. Don't use a resistor.
I am sorry for my late response but I had a lot of work. But I think that I wrote a wrong schema . It have to be connected like this:
It is true?
No, the switch goes simply between pin and ground. Nothing else needed.