Problems with 74HC4051 8-channel Multiplexer w/ Teensy 3.6

Status
Not open for further replies.
Hi all, I've been trying to use my multiplexer I got from Sparkfun so that I could use more potentiometers on my project and nothing seems to work. I've used the voltage from Vin as well as the base 3.3v and none of my pots will reach above 100. I would attach a photo but my circuit is such a mess, however I've quadruple checked and tried every combo and the wiring should be right, I might have the code wrong so that's why I'm here, I'm using a combo between the sparkfun hookup guide and a method paul recommendeded in a thread a while ago.
Code:
const int selectPins[3] = {31, 30, 29};
const int zInput = A13;

void setup() {
  Serial.begin(9600);
  pinMode(29, OUTPUT);
  pinMode(30, OUTPUT);
  pinMode(31, OUTPUT);

  delayMicroseconds(50);
  
  digitalWrite(29, HIGH);
  digitalWrite(30, HIGH);
  digitalWrite(31, HIGH);
  
  delayMicroseconds(50);
  
}

void loop() {
  for(byte pin=0; pin<=7; pin++) {
  int inputVal;
  inputVal = analogRead(A13);
  Serial.print(String(inputVal) + "\t");
  }
  Serial.println();
  delay(100);
}
void selectMuxPin(byte pin)
{
  for (int i=0; i<3; i++)
  {
    if (pin & (1<<i))
      digitalWrite(selectPins[i], HIGH);
    else
      digitalWrite(selectPins[i], LOW);
  }
}

Thank you for any help
 
Status
Not open for further replies.
Back
Top