I have successfully used a CD4051BE as a Mux and read analog sensor signals via anaolog pin 0 of the Arduino.
I thought that I would try and use the CD4051BE as a Demux. I also wanted to see if I could use this to light up some LEDs. I used a digital pin and using analogWrite(pin, 255); in the sketch I was able to light the LEDs. The problem is that I have 8 LEDs connected and only the first 6 light up. The LEDs are connected to Y0 to Y7.
Is there any reason why the LEDs on Y6 and Y7 don't light up?
The CD4051 in particular has a relatively high "on" resistance, about 300 ohms, so you are using it as the current limiting resistor for the LEDs. This is probably outside the specifications (current limit) for the device and not recommended.
The 74HC4051 has a lower "on" resistance, but even then is not really designed for the purpose.
Using a 4051 for an output device while possible is quite a dumb thing to do. This is because when not addressed the output is not being connected to anything. So if they are LEDs you have to multiplex to give the illusion they are on all the time. This uses a lot of your CPU time for no benefit, just use the right chip in the first place.
It may have been a dumb thing to do but I was only trying to prove a concept (that concept you may think is me being dumb). Thanks for letting me know that this could fry my chips (every pun intended) and I have been a very naughty boy.
Anyway, I'm working with 595 chips now so there shouldn't be any similar issues.