Need option on selection buttons

My project, in short, will perform three overall tasks.

  1. When turned on, plays audio and displays an LED boot-up sequence.
  2. Performs one of three tasks depending on the setting of a 3-way dial (rotary encoder) or instead of the dial, would be based on pressing three sizable buttons.

So, I'm wondering if a four-position dial (rotary encoder) would be better - first position nothing happens.
Or, three buttons. I'm looking all over at my opens for buttons or dials and i'm not sure from a user perspective which would be better and from there, where to source the parts, especially if a four-position dial (rotary encoder). I've found one on digikey but it's over $20. Compared to toggle switch prices, seems a lot more expensive.

To my credit, I've spent three days googling and looking at options and think I got myself into analysis paralysis.

Perhaps using terms such as "3-way knob" needs a bit more explanation. The knob is what your fingers grip. What is attached to the knob may be important.

Paul

I see what you mean. Rotary Encoder.

To my credit, I've spent three days googling and looking at options and think I got myself into analysis paralysis.

Please post your 3 or 4 best choices then we can comment on them, might help you choose.

Something like this?
It's a four position - 2 pole.

I would think so based on your description. I don't think a rotary encoder is what you need, at least if I understood you correctly.

The linked switch, I think, would be just what you want.

You would connect the common of one pole to ground and the four switch terminals of the same pole to digital inputs with their pinMode set to INPUT_PULLUP. The open switches will read HIGH and the, one, closed switch will read LOW. Read the four pins in setup to choose the mode.

Or you could wire the switches into a voltage divider and use 1 analog pin to read the switches. For more on this, Google "rotary switch arduino analog input".

Thanks, I'm new to the embedded-side of programming with the electrical side of things and trying to figure it out the best I can with tutorials and experimentation. :slight_smile:

With a single pole, 4 position rotary switch and 2 diodes, you could get away with only 2 input pins.

Suggestion:
Your first task (when turned on) could be put in setup.
The remaining 3 tasks could be selected with one simple pushbutton where your code checks if 1, 2 or 3 presses have been made. Just monitor one input and use a counter that auto-clears after 1 sec (allowing 1 sec max between presses). Any valid count is stored in a variable that's used to select the task.

Look to the state change detection example to see how to count the button presses to implement the strategy mentioned by dlloyd.