Krischomat
Well-known member
Hey Hey!
I started to experiment with a multiplexer (4051) to add more analog ins to my teensy project. I use the Analog-Digital Multiplexer Library and it works in a way. I just figured out that some pots are slighty changing values that they shouldn´t change. I am using teensy 4.1 here. The only thing is I just have 100k pots atm. Could this be an issue? Here is the code with just the multiplexer thing. I first thought it was an issue of my main programm which just has more stuff but it also happens in this stripped down code.
in void sendTest() I just tested if I can read the pot values in different voids. Strangely (or maybe not strangely) the value of potA in this sendTest() is different from the one out of the for loop. It seems to be more accurate...
I started to experiment with a multiplexer (4051) to add more analog ins to my teensy project. I use the Analog-Digital Multiplexer Library and it works in a way. I just figured out that some pots are slighty changing values that they shouldn´t change. I am using teensy 4.1 here. The only thing is I just have 100k pots atm. Could this be an issue? Here is the code with just the multiplexer thing. I first thought it was an issue of my main programm which just has more stuff but it also happens in this stripped down code.
Code:
#include <Mux.h>
using namespace admux;
int PotA = 0;
Mux mux(Pin(A13, INPUT, PinType::Analog), Pinset(1, 2, 3));
void setup() {
Serial.begin(9600);
}
void loop () {
int data;
for (byte i = 0; i < mux.channelCount(); i++) {
data = mux.read(i);
Serial.print(data);
Serial.print(" ");
}
sendTest();
Serial.println();
}
void sendTest() {
Serial.print("PotA = ");
Serial.print(mux.read(0));
}
in void sendTest() I just tested if I can read the pot values in different voids. Strangely (or maybe not strangely) the value of potA in this sendTest() is different from the one out of the for loop. It seems to be more accurate...
Last edited: