Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 3 of 3

Thread: Using Bounce library with multiplexer

  1. #1

    Using Bounce library with multiplexer

    Hi. In my project I have currently 8 tact switches connected directly to my Teensy 3.6 and I am using the Bouce library and its fallingEdge() method for a quick response of the buttons being pressed.

    Is it possible to use the Bounce library with the mux? I have searched in the forum and in the web but I have not found any reference to this.

    I have a 74HC4051E mux and I want it to control the 8 buttons. For the hardware hookup I have followed the section "Connecting Many Buttons & Knobs/Sliders" here, but I don't know how to implement the proposed code.

      // select 74HC4051 channel 5 (of 0 to 7)
      digitalWrite(1, HIGH);
      digitalWrite(2, LOW);
      digitalWrite(3, HIGH);
      // allow 50 us for signals to stablize
      // read the signals routed to pin 10
      // through channel 5 of each 74HC4051 chip
    How can I use now something like this?
    if (buttonMenu.fallingEdge()) {
       // do something

  2. #2
    Senior Member
    Join Date
    May 2017
    I do not know if it will work but it seems as though it should. You currently have 8 bounce objects all with a different pin. And you call the update function for each of those in turn.

    Conceptually, when you add the mux you would have 8 bounce objects all connected to the same pin. Before you call each update function, you would need to set the proper address on the mux. Then everything else would be the same.

    A slight delay may be needed after you change the mux address lines.

  3. #3
    Thank you, rcarr, it worked.
    I was confused about the mapping of the pins for the Bounce objects, as all buttons share the same pin. But creating 8 different objects routed to the same pin and updating them after adressing the mux did the job.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts