Selectable 'Potentiometer'

Hello, been working with 10K potentiometers lately and wondered what selectable knob many use when working with an Arduino?

I've been reading the values of the potentiometer (0-1023) through the serial monitor while sweeping the potentiometer through it's cycle and writing a sketch that says if (val<20... do this) or if (val>1000...do that). That is good but the knob has a sweeping motion. Is there a knob that I can use that has selectable points that provide a serial monitor readout? Rather than an on/off function...

Basically, if I wanted a knob that selects 1, 2, 3 and those selections reference portions of the sketch... what knob/switch are you using?

Thank you

That is good but the knob has a sweeping motion. Is there a knob that I can use that has selectable points that provide a serial monitor readout? Rather than an on/off function...

[u]Analog Read Serial Example[/u].

Basically, if I wanted a knob that selects 1, 2, 3 and those selections reference portions of the sketch... what knob/switch are you using?

It's generally a bad idea to use a pot (analog) for a digital function.

But, you can do something like this:

if (0 <= AnalogValue && AnalogValue <= 100) // If value is between 0 and 100

if (101 <= AnalogValue && AnalogValue <= 200) // If value is between 101 and 200

It's better to use a multi-position rotary switch, a few pushbuttons, or one button that cycles-through different functions, etc.

I think the term you need is "detent" try searching for "potentiometer detent"

MarkT:
I think the term you need is "detent" try searching for "potentiometer detent"

Yes! Perfect, thank you

Another option, if you have only a few positions to watch, and you need to use an analog input - is to get an SP#T (where # is the number of positions) rotary switch, and wire up different resistors for each position - then read the values with an analog pin connect to the common wiper terminal of the switch.

Great idea by cr0sh, here's a small variation and diagram...

If only 3 selections are needed, then a 3 position rotary switch and 2 resistors could be used. You would get 0, 512 and 1023 for readings ... you could detect ranges form 0-100, 400-600, 900-1023 for the switch settings (for example). Easy to expand on this ... for a 5 position switch, just use 4 equal valued resistors in series.

You can also use an encoder for this type of thing. Needs a bunch more digital pins to interface with them though.

Chagrin:
You can also use an encoder for this type of thing. Needs a bunch more digital pins to interface with them though.

Total of two to be precise, three if you want a "select". (I am thinking of a quadrature encoder, not of course an absolute, which is as much of a headache as a potentiometer.)

Advantage is there is no limitation whatsoever on the range. Can also incorporate a "swipe" function.