Can a multiplexer handle more than one type of input<control surface.h>

Hi, just making a cheap homemade midi controller. I was wondering if a cd74hc4061 multiplexer, using (mux) in library, is able to have buttons and potentiometers running through it? Say 10 pots and 6 buttons? Or is it must be an array of the same type of input, say 16 potentiometers or 16 buttons?
I am a disability pensioner(autism) and have trouble with writing, please don't shred me for not giving enough information. As I can see happens to most people who ask beginner questions here.

You can have multiple muxes, but putting them through a single channel would probably invoke more complexity than you want - especially if you’re asking this at the outset.

It’s quite easy to implement a mux for each type of input signal, and will make it much easier to check parameter limits, and otherwise filter and control the various sources.

Yes, having potentiometers and buttons on the same multiplexer shouldn't be an issue. Buttons use the digitalRead function and potentiometers the analogRead function.
The buttons will cause the internal pull-up resistor to be enabled, but this shouldn't be an issue for the potentiometers.

You mean 74hc4051, right?

maybe CD74HC4067 8 channel analog switches.

It is always a good idea to write a pretty detailed description of your project which tells

the microcontroller-type you are using
and a functional description of what you want to do
cheap midi-controller can still be very different things:
do you want to:

  • play musical notes
  • control lights
  • send midi-signals at a low speed to change software-settings

The final purpose has an influence on the solutions that are suitable

Same thing with the interface very classical midi-DIN-plug or USB-midi?

best regards Stefan

Thanks friendos, Arduino leonardo, USB-MIDI, CD74HC4067(error in op)(16:1 mux), would like to split 2 faders, 6 pots, 2 buttons latching, 2 buttons and 4 leds. If I can split these functions on 1 mux I can make 3 modular pieces that can be joined together. This suits me as I can buy parts as I can afford them. I think maybe the leds won't work though as I re-read the post from PieterP.
All of your helpful input is very much appreciated. Very nice guys.
BTW I have made a 12 channel with pots and buttons and it works great, and it was just plug, program and play. This library means someone like myself that will never be able to understand programming can be involved. THANKYOU!

Hey there thanks for the tip(and the library?). I will go ahead and see if I can get it to work and I will post back here with the code I use(working or not?), as it may be helpful to others in future. All the best.

Thanks for your time, what you said, was my experience so far. Putting one signal type per mux worked without a hitch, but when I assigned the different functions of button and potentiometer, neither worked.

#include <Control_Surface.h>

USBMIDI_Interface midi;

// Instantiate an analog multiplexer
CD74HC4051 mux = {
  A3,       // Analog input pin
  {2, 3, 4} // Address pins S0, S1, S2
};
CCPotentiometer volumePotentiometers[] = {
  {mux.pin(0), {MIDI_CC::Channel_Volume, CHANNEL_1}},
  {mux.pin(1), {MIDI_CC::Channel_Volume, CHANNEL_2}},
  {mux.pin(2), {MIDI_CC::Channel_Volume, CHANNEL_3}},
  {mux.pin(3), {MIDI_CC::Channel_Volume, CHANNEL_4}},
};
  CCButton button1 [] =  { 
  {mux.pin(4), {MIDI_CC::General_Purpose_Controller_5, CHANNEL_4}},
  {mux.pin(5), {MIDI_CC::General_Purpose_Controller_5, CHANNEL_5}},
  {mux.pin(6), {MIDI_CC::General_Purpose_Controller_5, CHANNEL_6}}
   };



void setup() { Control_Surface.begin(); }
void loop() { Control_Surface.loop(); }

Hello, this is a note to thankyou for your replies. Writing is very difficult and time consuming for me. Please accept my apologies for the staggered nature of my replies and often incorrect use of words and most likely incorrect formatting.
Your patients is does not go unnoticed.

1 Like

bump

without providing links to downloads of all the libraries your project is using
and without providing the full sketch from the very first to the very last line

any "bump" is useless

So would using cortana to speak your questions into your computer an easier way?

There is no way around posting detailed descriptions of what your code shall do and what behaviour you watch running the code.

So maybe recording a video, uploading it to youtube and posting a link is easier to show the behaviour of your code.

Your posting sounds fatalistic trying to create a huge amount of patience for you.

So my suggestion is:
Or you re-define the goal of your project:
uploading guessed code analysing what the guessed code is doing

or maybe finding a friend who is able to read your mind.

best regards Stefan
P.S.: I'm asking myself if there is an untalented kind of troll out there trying to get people investing time by slowly-low-level-trolling

Hello bloopbloop160,

first of all if my posting created bad feelings I want to say I'm verry sorry this was not my intention.

I'm not a moderator and I don't try to achieve to become one. Even if I would I estimate the moderators would say no because I have a straight forward way to be honest which can cause bad feelings.

I want to say thank you that you wrote about the real reasons why you write postings like you do. With knowing it I can change to a style of answering that - hopefully - is helpful. If you wish that I answer not anymore to you I obey.

Still posting a complete sketch will help to understand what you have coded so far.

Again: I want to say I'm really sorry if my posting caused bad feelings.
best regards Stefan

So reading and writing seems not too difficult for you. Otherwise you wouldn't have read so many postings and taken the effort of writing this answer.

you are right these lines of code complete the sketch.

And you are right I did not take the time to carefully analyse the sketch or to lookup the library.

For the convenience of all users for an easy look-up how the control-surface-library works
Here is the link to the control-surface-library

below all the subfolders there is a documentation section with example-codes
and a link ho to Getting started with the USB-MIDI control_surface-library

The way I posted made you hate me. After this posting I decide to stay away from this thread.

Moderator involved.

Guys please keep it civil (all of you).
I killed a couple of posts.

OP when asked for specific information please do your best to supply what was asked for eg. schematic, codes and so on. It make life for those wanting to help so much easier.

Responders please I know it can be a royal pain to keep asking for the same things over and over in all the posts but please bear in mind that sometimes it can be a little hard for the OP.

If in doubt

The easier you make it to read and copy your code the more likely it is that you will get help

Please follow the advice given in the link below when posting code , use code tags and post the code here

If you get errors when compiling please copy them from the IDE using the "Copy error messages" button and paste the clipboard here in code tags

This is not what this is about, baiting, dismissing disabled people as trolls attempting to vampire the valuable time of others. This is incredibly offensive and with the way he was trying to create support for his cause borders on hate speech.
Please dont think im complaing about what you have written above OMFG :scream:

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.