AdmiralCrunch
Well-known member
Hey folks,
i apologize in advance for this, .. this is really stupid, but don't know what to do anymore :/
i am working on a bigger project (some of you may know me because i often ask questions here) .. at a point I needed to re-produce a part of my circuit on the breadboard for testing/debugging. I did this about a hundred times now and it is really simple .. but my circuit goes totally mad and I really can't help myself.
so here is the problem:
.. distributed on two breadboards I have:
breadboard1: .. the T_3.6 and a pushbutton (which is not connected to the teensy)
breadboard2: .. a 74HC4051-multiplexer, to which 8x switchbuttons are connected.. the 4051-out goes to T_3.6-pin 15
- one 74HC4051-multiplexer, to which 8x switchbuttons are connected.. the 4051's out goes to T_3.6-pin 15
- one seperate switchbutton, .. which is not connected anywhere
now the following happens:
- when I press the one seperate switchbutton, it somehow triggers the signals at all 4051-inputs..
- when I press one of the buttons connected to the 4051, it also triggers the signal at all 4051-inputs
how can this be?
the code should work, I have extraced it from my already working project.
i apologize in advance for this, .. this is really stupid, but don't know what to do anymore :/
i am working on a bigger project (some of you may know me because i often ask questions here) .. at a point I needed to re-produce a part of my circuit on the breadboard for testing/debugging. I did this about a hundred times now and it is really simple .. but my circuit goes totally mad and I really can't help myself.
so here is the problem:
.. distributed on two breadboards I have:
breadboard1: .. the T_3.6 and a pushbutton (which is not connected to the teensy)
breadboard2: .. a 74HC4051-multiplexer, to which 8x switchbuttons are connected.. the 4051-out goes to T_3.6-pin 15
- one 74HC4051-multiplexer, to which 8x switchbuttons are connected.. the 4051's out goes to T_3.6-pin 15
- one seperate switchbutton, .. which is not connected anywhere
now the following happens:
- when I press the one seperate switchbutton, it somehow triggers the signals at all 4051-inputs..
- when I press one of the buttons connected to the 4051, it also triggers the signal at all 4051-inputs
how can this be?
the code should work, I have extraced it from my already working project.
Code:
int muxPin1 = 2;
int muxPin2 = 3;
int muxPin3 = 4;
int muxPinInh = 5;
// PINS D
int btnTrackSelectPin = 15;
int btnShiftPin = 14;
int MuxBit1;
int MuxBit2;
int MuxBit3;
bool shiftStatus;
#include <btnTrackSelect.h>
btnTrackSelect btnTrackSelect[16];
#include <Bounce.h>
Bounce btnShift = Bounce(btnShiftPin, 10);
void setup() {
// 4051 - ctrl
pinMode(muxPin1, OUTPUT);
pinMode(muxPin2, OUTPUT);
pinMode(muxPin3, OUTPUT);
pinMode(muxPinInh, OUTPUT);
// 4051 - INPUT PINS
pinMode(btnTrackSelectPin, INPUT);
pinMode(btnShiftPin, INPUT_PULLUP);
Serial.begin(9600);
while ( !Serial && (millis() < 4000) ) {
// ..
}
Serial.println("SERIAL PORT INITIALIZED");
}
void loop() {
pollShift();
for(int i = 0; i <= 7; i++) {
// count through MUX
digitalWrite(muxPinInh, HIGH);
MuxBit1 = bitRead(i, 0);
MuxBit2 = bitRead(i, 1);
MuxBit3 = bitRead(i, 2);
digitalWrite(muxPin1, MuxBit1);
digitalWrite(muxPin2, MuxBit2);
digitalWrite(muxPin3, MuxBit3);
digitalWrite(muxPinInh, LOW);
delayMicroseconds(40);
btnTrackSelect[i].btnStatus = digitalRead(btnTrackSelectPin);
if (btnTrackSelect[i].btnStatusOld != btnTrackSelect[i].btnStatus) {
Serial.print(i); Serial.print(" : "); Serial.println(btnTrackSelect[i].btnStatus);
btnTrackSelect[i].btnStatusOld = btnTrackSelect[i].btnStatus;
}
}
}
/* Polls Shift-Button and sets Status-Var */
void pollShift() {
if (btnShift.update()) {
if (btnShift.fallingEdge()) {
shiftStatus = true;
Serial.println("Shift pressed..");
} else {
shiftStatus = false;
Serial.println("Shift released..");
}
}
}