4051 Multiplexer example code?

does the blink rate change if you torn the potentiometer ?

The analogRead should return a number in the 0 - 1023 range 0 when the pot is all to one side and 1023 when it's all to the other side.

Try changing the loop to this, and enable the serial monitor in Arduino

void loop () {

for (count=0; count<=7; count++) {

row = bin[count];

r0 = row & 0x01;

r1 = (row>>1) & 0x01;

r2 = (row>>2) & 0x01;

digitalWrite(2, r0);

digitalWrite(3, r1);

digitalWrite(4, r2);

Serial.println(analogRead(4)/4);

delay (200)

}

This should write 8 bytes to the serial monitor, the first from your pot, should give you values between o and 255 when you turn the pot.

The other 7 could be anything since they are from the 7 pins on the 4051 with nothing connectd to them.

I'm of to bed in a second, it's very late over here :slight_smile: but i will chek up tomorrow.