Firstly, I am not a programmer by any stretch. What I've figured out and know so far has essentially been through Google and the lovely teacher that is trial and error. Now, while I am not a well versed programmer I do know my way around circuit design. To illustrate this point I solved what should be a software problem with a hardware solution.
What I am trying to do currently has a lot of parts, but the vast majority of the parts do effectively the same thing software wise. For example say there are three momentary pushbuttons. Each button does a different function. However, functionally within the software the only difference is what is controlled. The actual logical steps are the same.
So, what it is that I am trying to do? Well I am trying to make an audio pre-amplifier that has a remote control as well as physical controls. To that end I'm using a Nano Every because I have a few on hand. I can elaborate on the specifics of the circuit, but that is not too terribly important I think for what it is I am trying to accomplish. However, the switches are debounced physically and the Arduino itself is not heavily loaded on its outputs. Think driving some 7400 series logic or an IC directly kind of thing.
What I have are 5 switches, 1 rotary encoder, and 1 IR Remote plus receiver. The rotary encoder though was mostly solved through hardware rather than software. The output of the rotary encoder from the perspective of the Arduino is just an 8-bit binary number.
Functionally, what I want the Arduino to do is the following:
- One switch to cycle between inputs
- One switch to toggle a mute and when toggled off remember which was the last input
- One switch to toggle an input pad (can't overload the analog stuff, it sounds bad)
- One switch to toggle a volume limit (basically caps the maximum value sent to the DAC)
- One switch to toggle a Fine Adjustment for the DAC (think like 1dB adjustment regular and 0.5dB with fine adjustment on, I'm not against velocity but I have ZERO idea how to even attempt that)
- A rotary encoder to control the volume up & down
- A remote that duplicates all those functions (there are enough buttons available and I know the commands for each individual button as confirmed on the Arduino itself)
Quick note some of these functions are just a quirk of where it is meant to be used.
I would think the best way to accomplish what I am trying to do would be a state machine of sorts. However... I have one small issue with that... a DAC. The volume control on the preamp is through some VCAs and a rotary encoder is cheaper and easier to find than a motorised potentiometer. From my understanding of state machines (I could be completely wrong here too) I would have to include a state for each possible configuration of the DAC, which is 16-bits... I think that is a bit excessive.
This is not something I cannot foresee an Arduino being able to do nor are there are any really esoteric functions to be implemented. But I know I am going to have problems when even getting a toggle to work is causing me frustration (I can be dense). Some direction and the like would be greatly appreciated!