Hysteresis

I think that temperature control may provide the most basic examples of use of hysteresis. The concepts of thermal inertia and time become simple and clear, the set points become design decisions, the HVAC hardware becomes better known and you don't end up with a heater and AC fighting or heater starters burning out early and higher bills to show for it.

Alto --- do you want a slider to give back 40 positions for the full movement range? You can do that easily while reading 8x default speed since you don't need great precision. The analog value will be an unsigned integer 0 to 1023 which divided by 40 is 25.75, but you say 25 per step and that 1st step is zero while the last half-step is 40 and keep the math unsigned 16-bit.

For speed you could PROGMEM a table of 1024 bytes, 1 for analog read's 0 to 1023 return range, the read is the index, it doesn't get simpler or quicker and there's plenty of flash to spare.

Nick Gammon's site has a great tutorial on analog digital conversion including ADC clock speed control with tests and results to maybe inform your project design at little. :slight_smile: