davidteensy
Member
I have researched widely on the 4051 multiplex chip on the internet, and found some useful info. But I have not been able to deduce a code that fit's my needs.
I am trying to use the 4051 to read eight buttons (momentary switches), and then write to led's depending on the buttons latest state. I know how to write the code for this using the teensy alone (in a few different ways), but I require more pins then come on the teensy. maybe I need a different chip then the 4051? but from what I have read I should be able to use it...
from the teensy site -
// select 74HC4051 channel 5 (of 0 to 7)
digitalWrite(1, HIGH);
digitalWrite(2, LOW);
digitalWrite(3, HIGH);
// allow 50 us for signals to stablize
delayMicroseconds(50);
// read the signals routed to pins 10, 19, 20
// through channel 5 of each 74HC4051 chip
buttonPin10channel5.update();
-
ok, that, and other sources, show me how to select one of the pins on the 4051, and initiate a delay to allow the chip to be read/written.
but my question is regarding the debounce for the button... my attempts to turn on an led with the above example have not worked.
I will provide my attempted code later today, and verify my schematic with y'all, but in the meantime any clear ideas to aid me in my project would be great.
thank you
I am trying to use the 4051 to read eight buttons (momentary switches), and then write to led's depending on the buttons latest state. I know how to write the code for this using the teensy alone (in a few different ways), but I require more pins then come on the teensy. maybe I need a different chip then the 4051? but from what I have read I should be able to use it...
from the teensy site -
// select 74HC4051 channel 5 (of 0 to 7)
digitalWrite(1, HIGH);
digitalWrite(2, LOW);
digitalWrite(3, HIGH);
// allow 50 us for signals to stablize
delayMicroseconds(50);
// read the signals routed to pins 10, 19, 20
// through channel 5 of each 74HC4051 chip
buttonPin10channel5.update();
-
ok, that, and other sources, show me how to select one of the pins on the 4051, and initiate a delay to allow the chip to be read/written.
but my question is regarding the debounce for the button... my attempts to turn on an led with the above example have not worked.
I will provide my attempted code later today, and verify my schematic with y'all, but in the meantime any clear ideas to aid me in my project would be great.
thank you