encoder

What do you want to happen when the pot values are between the examples you gave. Should the threshold smoothly increase from 0 to 40 as the pot rotates to the right?
Are there two encoders?

thank you. yes, i want the threshold to be increased from 0 to 40 smoothly according to the rotation of the encoder. I use only one encoder and two arduinos.