Hi guys, I'm new in this arduino world, so tehre are many basic things that I still don't understand... and multiplexers are one of this. So, if you can help me whith this problem I'll really aprecciate it!
The thing is, I'm trying to select every channel from an 8-channel multiplexer (74HC4051), and show the values of the potentiometers connected in the serial monitor. I have 8 pots connected in every channel. I'm using the library Mux.h
Everything is fine until channel 3... from channel 4 to 7 the serial monitor repeats the same values than channels 0 to 3, and if a move, for example the pot connected in channel 6, nothing happens.
In other case, if I move the pot connected in channel 0 the monitor shows the same value in channel 0 and 4.
I'm doing this just to understand how I can select the channels of a multiplexer
Any, idea about what is happening? I think is the code, because when I use another code all the pots works fine
my code:
#include <Mux.h>
using namespace admux;
Mux mux(Pin(A0, INPUT, PinType::Analog), Pinset(8, 9, 10));
void setup() {
Serial.begin(9600);
}
void loop() {
int ch0 = mux.read(0);
Serial.print("Canal 0 esta en "); Serial.println(ch0);
int ch1 = mux.read(1);
Serial.print("Canal 1 esta en "); Serial.println(ch1);
int ch2 = mux.read(2);
Serial.print("Canal 2 esta en "); Serial.println(ch2);
int ch3 = mux.read(3);
Serial.print("Canal 3 esta en "); Serial.println(ch3);
int ch4 = mux.read(4);
Serial.print("Canal 4 esta en "); Serial.println(ch4);
int ch5 = mux.read(5);
Serial.print("Canal 5 esta en "); Serial.println(ch5);
int ch6 = mux.read(6);
Serial.print("Canal 6 esta en "); Serial.println(ch6);
int ch7 = mux.read(7);
Serial.print("Canal 7 esta en "); Serial.println(ch7);
Serial.println();
delay(1500);
}
Thanks!