RetroPie forum home
    • Recent
    • Tags
    • Popular
    • Home
    • Docs
    • Register
    • Login
    Please do not post a support request without first reading and following the advice in https://retropie.org.uk/forum/topic/3/read-this-first

    Raspi with an Mux and simple Buttons

    Scheduled Pinned Locked Moved Help and Support
    raspi zero wbuttonsmuxmux74hc4067configure
    1 Posts 1 Posters 696 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M
      machete
      last edited by

      Hi there!

      Lets hold it short, what i want todo:

      Raspi pi Zero W + MUX Board (MUX74HC4067) + Simple Buttons

      So, what i want to do is to use only about 5 GPIO Pins from the Raspi pi zero w with an MUX together.
      The main code for the raspi would be sth. like this:

      void loop()
      {
      byte data;

      for (byte i = 0; i < 16; ++i)
      {
      	// Reads from channel i and returns HIGH or LOW
      	data = mux.read(i);
      
      	Serial.print("Push button at channel ");
      	Serial.print(i);
      	Serial.print(" is ");
      	if ( data == HIGH ) Serial.println("not pressed");
      	else if ( data == LOW ) Serial.println("pressed");
      }
      

      So i would get the information which button depending on i, and could send and information to the Serial Port.
      The buttons would be the normal simple Buttons like this one here:
      alt text
      I would just connect them to with a resistor to the MUX to make a defined: "high" and " low"

      So my main Question is:
      Is there a possibility to configure Buttons to the Serial Port?
      IF Yes - How?
      IF Not - What else would you assume?

      If you have any other questions please feel free to ask!

      Best regards
      Machete

      1 Reply Last reply Reply Quote 0
      • First post
        Last post

      Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.

      Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.