Ranging the scale of a potentiometer

Is there a possibly to adjust a the range of potentiometer to 50 - 1023 instead of 0 - 1023 ?

1 Like

Use the map() function

The problem on that is if I use map from 50 to 1023 he is at - 52 when I am 0 at the Potentiometer.

Nvm i figured it out thanks alot :joy: :hugs:

Can I suggest that you post your solution

Of course, if you don't actually need the values below 50 you could just ignore them or substitute a value of zero but it depends on your application

Glad you’ve got it working… in addition to map(), take a look at constrain() for future use.

int y = analogRead(0);                               
y = map(y, 0, 1023, 50, 1023); 
1 Like

It's also possible to use linear mathematics.

1 Like

As more knowledge gets buried in functions and libraries and frameworks and black boxes, it only means ppl like you will be more valuable.

a7

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.