Building a MIDI Controller but I'm having a difficult time finding a suitable 4-position rotary switch (not an encoder). This switch will send MIDI CC messages to connected devices and will specifically choose the oscillator waveform. There are four possible waveforms the oscillator can generate: Square, Saw, Triangle, Sine. This switch will control which wave is generated.
Suggestions for switch make/model? Having a tough time finding something suitable. Thanks in advance.
Yes, the ground pin of the switch will go to the ground bus (pin) and the other four pins will connect to analog input pins. This is purely to connect to the Arduino to select which MIDI CC messages to send, which will select which waveform the oscillator generates.
That doesn't quite make sense. Do you mean that the 4 pins will connect to 4 analog inputs? If so, why analog inputs? They will be digital signals.
Or did you mean 4 pins will connect to a single analog input? You could do that by connecting the common pin to the analog input, pin 1 to ground, pin 4 to Vcc and adding 3x 1K resistors between pins 1, 2, 3, 4.
Another method, if you are short of analog pins, would be connect the common pin to ground, connect the common pin to ground, pin 1 to an Arduino digital pin with a diode, pin 2 to a second Arduino pin with another diode, pin 3 to both those 2 Arduino pins with 2 more diodes and leave pin 4 unconnected.
Thanks for the reply @awneil and @PaulRBryson - I am not familiar with putting together electronics or using Arduinos at all, totally new. Have been reading and reading, but there's a lot to absorb. Apologies for the newbness.
@PaulRB I have available digital inputs, yes for sure. Would this ask become easier if I were to use the digital input pins on my Leonardo instead of analogue inputs pins for this Sp4t rotary switch implementation? Thank you.
The easiest method is to use 3 Arduino pins for the switch because no extra components would be needed. These could be digital or analog pins, but if you used analog pins, you would not really be using them as analog pins, you would be using them as digital pins (which they can also do, with rare exceptions). That could be a waste, because most Arduino have fewer analog pins compared to digital, making analog pins more valuable.
You could reduce the need for 3 digital pins to 2 by using 4 diodes.
You could reduce the 3 digital pins to 1 but that pin would have to be an analog pin, and 3 resistors would be needed.
@awneil meant so say that analog pins are a rarer commodity.