problems using potentiometer

I am using a potentiometer to make changes in the serial monitor.

However (I don’t know whether the potentiometer or the way I am using is the problem) I get a output like this.


I am trying to make the graph smoother(like the picture below) but I can’t think of anything except of writing hundreds of “if (100<x<140){…” s… Can anyone help me with it?

I connected the potentiometer like this (on

And The code I made and tested is

const int potentiometer = A2;
void setup(){
void loop(){

Your potentiometer could be a logarithmic type (as used for volume controls on audio equipment), rather than a linear type.

Also, your code is using A0 but your photo shows the pot wiper connected to A2. But I guess that may just be a typo in the code or image :)

I just found that the potentiometer I was using was a logarithmic one. Thank you! XD

Those stupid smiley faces scrolling by contribute NOTHING to your post. The DO irritate the beejesus out of most of the regulars. Don't do that again.