Hi!
I wrote this little app to read from specific inputs on a multiplexor and I have 8 small potentiometers.
The problem is that when I ativate one input and read it's value it still reads all the other 7 values so it doesn't matter which input I activate I can still change the value with any of the potentiometers.
I'm using a: 74HCT4051N multiplexer
and regular analog potentiometers.
My code:
int analog1 = 0;
int value = 0;
void setup() {
beginSerial(9600); // connect to the serial port
}
void changeMpu(char val1, char val2, char val3) {
digitalWrite(1, val1);
digitalWrite(2, val2);
digitalWrite(3, val3);
}
void loop() {
changeMpu(LOW, LOW, LOW);
delay(1000);
printString("A");
value = analogRead(analog1);
printInteger(value);
serialWrite(10); // <-- end of line
serialWrite(13); // <-- carriage return
changeMpu(HIGH, LOW, LOW);
delay(1000);
printString("B");
value = analogRead(analog1);
printInteger(value);
serialWrite(10); // <-- end of line
serialWrite(13); // <-- carriage return
}
Thanks in advance!
/sebb0