I’ve been working with the Mayhew Labs mux shield 2 for some time now, and I’ve been seeing some strange behavior. I’m using two banks of the shield for digital output. When using the MuxShield.h library and writing to a pin, sometimes the write goes to two pins. This has been somewhat inconsistent, but lately I’ve narrowed the problem down to the following:
//This example shows how to use the Mux Shield for digital outputs
//Initialize the Mux Shield
//Set I/O 1, I/O 2, and I/O 3 as digital outputs
for (int i = 0; i < 16; i ++)
This code turns on three output values - Bank 3 0 and 1, and bank 2, 0. Or rather, it turns off those three values. I’m running a HIGH==OFF type connection, so that’s why I set everything to high before I begin. Any thoughts? Is the shield bad?
BTW, this is not my actual code, but a tester I’ve been using to see if I can’t nail down the problem… no luck so far…
Thank you all for any help or tips you guys can provide!!
I'm pretty sure you can't output to more than one pin (per bank) at a time. Each "bank" acts as an 8-way switch, connecting one of the 8 pins to an Arduino pin: A0, A1, or A2. You can use the analog pins as digital outputs but that output can only be connected to one of he eight pins of the bank. The other pins of the bank will 'float'.
Hey, thanks for the quick reply! Your answer is to the point, for sure! The shield that I have has 6 (I think) shift registers on it as well as the “8 way switch” option. From what I can see in the mux shield library, the pin selection is stored in an array, then bit shifted out to the shift register when something changes. I’ve been bit shifting to the shift register after selecting it using the selector. What’s weird is that my example code works fine if I use bank 1 and 2. I really suspect that the board is bad - I just hate to have to rebuild stuff now.
You mentioned that I can output using the analog out directly to one pin at a time, using the mux shield as a selector rather than a shift register. I may end up doing that for some of the output and the other output will wait.
Now I am filled with doubt - Are you sure that the shield only allows one pin at a time? They hold the HIGH value just fine (and there is a load attached, so they wouldn’t float).
Anyway, thanks for the quick reply - I really want to hear someone tell me that the board is bad OR I’m crazy. I just have to double check for the second choice!
Now I am filled with doubt - Are you sure that the shield only allows one pin at a time? They hold the HIGH value just fine (and there is a load attached, so they wouldn't float).
My mistake! I was familiar with the earlier model that only had the three 16-bit analog selectors. The new model has added six 74HC595 8-bit shift registers (two for each 16-bit selector) for output pins. It looks like each 'bank' can be used for digital output (shift registers) or analog/digital input (selectors).
This code turns on three output values - Bank 3 0 and 1, and bank 2, 0. Or rather, it turns off those three values. I'm running a HIGH==OFF type connection, so that's why I set everything to high before I begin.
It appears to set only 3,0 and 2,0 LOW. The line to set 3,1 LOW is missing.
Yes it should only set two pins to low. However I am getting three pins low when running this code on the mux shield. Bank three has two pins low right next to each other.
Is this a known issue or bug with this shield? Or did I damage the shield somehow while assembling it?
Thanks again for your replies, I’m very happy that you responded. I feel like I’ve been losing my mind with this project, and so I just need to know if it’s the shield or me!!
It could be a solder bridge. Check for a short circuit between the pin you WANT to be LOW and the pin you don't want to be LOW.
So I took a super detailed look at the soldering for the pins and I think I found a bridge between a couple of the pins. It is VERY small too, just a slight touch between two of the pins. I'm going to clean up the soldering today - hopefully this will fix it!!
I can't begin to tell you how long I spent thinking it was something in my code causing the problem. I will be so happy if I solve it!
Thank you !!
Thanks for all of your help. I couldn't find any solder bridging, but it was an early soldering project so maybe I created a problem with something while soldering. So to solve the problem, I got a bigger arduino! I'm using almost all of the mega's pins, but the mega is working just fine for me.
So, problem not really solved, but sort of?
Just wanted to share the "resolution" of this problem. Once I've finished my project, I'll take a closer look at the shield and maybe try fixing it.