Connecting 2 Mux Shield II from Mayhew Lab

Hi all,

I post this just for information. In my model train project I need a lot of input and ouput signals. So last year I bought 2 Mux Shields II from Mayhew Lab.
I connected last year one of them by stacking it on top of my Arduino.

And now it was time to extend it with the second one.
I connected everythng and assigned other pin connection to the second MUX.

Here the code to make the 2 instances of the muxshield object.

#include <MuxShield.h>
//Initialize the Mux Shield
//MuxShield::MuxShield(int S0, int S1, int S2, int S3, int OUTMD, int IOS1, int IOS2, int IOS3, int IO1, int IO2, int IO3)
MuxShield muxshield1 ( 2, 4, 6, 7, 8, 10, 11, 12, A0, A1, A2);
MuxShield muxshield2 ( 22, 23, 24, 25, 26, 50, 51, 52, A3, A4, A5);

When I tested everything the result was very strange. It looked that the first instance I defined was working, the other one not.
As I'm a programmer for my work,i looked into the code of the library and I think that some variables of muxshield1 are also used by muxhield2.

So I changed the muxshield.h library and added following line in the private section

bool _IO1IsOutput, _IO2IsOutput, _IO3IsOutput;

Attached the complete muxshield.h file.

And now it's working fine.

So if somebody else has the same issue, here is the solution.
Or if somebody else has other idea's or solutions, please let me know.

Kind regards

Marc

MuxShield.h (883 Bytes)