I just stumbled upon the magical creation that is a multiplexer. All the articles I found about them says you can use it as an input OR an output. I am wondering; is it possible to have a photo-resistor on pin-1, and when that reads value x have it trigger pins 2,3, and 4 to move servos to predefined locations? I suppose there is a second question in here, which is can you run PWM thru a multiplexer?
Would either thing be possible on this:
http://www.sparkfun.com/products/9056
Or would I need something more like this:
http://www.sparkfun.com/products/9832
in order to make in & out possible.
-Alex
TheatreTech:
I just stumbled upon the magical creation that is a multiplexer. All the articles I found about them says you can use it as an input OR an output. I am wondering; is it possible to have a photo-resistor on pin-1, and when that reads value x have it trigger pins 2,3, and 4 to move servos to predefined locations? I suppose there is a second question in here, which is can you run PWM thru a multiplexer?
Think of multiplexers as nothing more than a set of dumb switches. Something has to tell the set of switches which switches are to be on and which to be off. The multiplexer itself doesn’t make that decision. You can combine the multiplexer with a microcontroller (MCU) and program that MCU to make those decisions. In your example above, it appears at first glance that you need some sort of intelligence more than you need a multiplexer. Servos require a constant stream of pulses to tell them where to position. If you want different positions from servo to servo that’s multiple streams/channels needed. You’d be better off using an MCU with 2 more pins than trying to use a single channel of PWM and send it to 3 places (at different times) via a multiplexer. After all your PWM source (?an MCU?) would need some output pins to tell the multiplexer (since it’s dumb) which of its pins (switches) to turn on/off.
Look at the 1’st link you posted. It’s a 16:1 multiplexer, meaning it can take any 1 of 16 channels and connect that channel to 1 other pin. But there’s another 4 digital pins used to tell the multiplexer which of those 16 pins is to be connected to that 1 pin.
The 2’nd link is really nothing more that 3 of the above in a form factor that plugs on top of an Arduino. It allows the Arduino to choose 3 out of 48 inputs and route those 3 choices to analog pins 0, 1 and 2 of the Arduino. The Arduino itself has another multiplexer (internally) that would allow you to choose which of those 3 pins to send to the A/D converter to get a voltage reading.