@lar3ryThanks, I will try that out. It will take some time though with my abilities... For me it's good enough to know what's possible.

Quote

Presumably, you want to be able to change the set point while it's running, so the set temperature should be available from loop()

No, after setting I have no need to change it. If I wanted to, I could simply reset the whole Arduino and start again.

Application is a simple box that keeps things warm till I disconnect it from power, which is after 30 minutes or so. I use it already now, but I do set the temperature in the sketch and then upload it.

One problem with using setup to set a value from a rotary encoder is that the setup code may have completed (within a fraction of a second) before the user gets a chance to move the encoder. Of course the encoder could be positioned before the Arduino is started or restarted - but this all seems messy.

One problem with using setup to set a value from a rotary encoder is that the setup code may have completed (within a fraction of a second) before the user gets a chance to move the encoder. Of course the encoder could be positioned before the Arduino is started or restarted - but this all seems messy.

So far it does not seem stable. I stay between a few Seconds to just milliseconds in Setup. I didn't try functions so far, but think I might be more comfortable to put the setup in the void_loop() and let the input just run once.

Your use of language is very confusing. In the Arduino world "setup" has a very specific meaning and you can't "put the setup in the void_loop()". Also "let the input just run once" can't happen if it is in "void loop()".

There is nothing to stop you having a "loop" (not the void loop()) within setup() which waits for a button press - for example (assuming a button press causes a LOW)

So far it does not seem stable. I stay between a few Seconds to just milliseconds in Setup. I didn't try functions so far, but think I might be more comfortable to put the setup in the void_loop() and let the input just run once.

Functions are just chunks of coe wrapped in a named block of code. Of course, you don't have to use functions, especially for something that only has to done once.

So, an alternative to what I posted before is to place the entire setting procedure in setup()

void setup() { set up anything required for the rotary encoder set up anything required for the PID while button not pressed { do the rotary encoder reading, setting the new data into your temperature variable(s) }}

void loop() { do anything required to run PID}

Quote

What's a good 'waiting for button input' routine?

In this case, you don't even need debouncing, because the button will not be pressed at startup, and you only care about it being pressed one time. Robin2 gave you the actual code, assuming your button gives you HIGH when it's pressed.

There are 10 kinds of people in the world,those who understand binary, and those who don't.