How to stop changes ?

ted:
Originally was 2 and as i said the problem is not here

It IS there. You never assign a new value to val, so it will ALWAYS show the same results.

Please read post #36, with " lcd.print(vin, 2);" original is working properly

ted:
Please read post #36, with " lcd.print(vin, 2);" original is working properly

You seem to have problems with responding to questions with anything that resembles an intelligent answer. Instead, you respond with something that doesn't answer the question.

I give up.

So it looks like Ted is a problem not program.

Not sure about Ted, but ted certainly is.

ted:
Please read post #36, with " lcd.print(vin, 2);" original is working properly

As has been pointed out, in the code from post #34 vin is an int, and its value never changes after it is initialised to zero.

So, how could it be working right ?
How could it print 2 (or 3) decimal places when it is an int ?

Look at this.

int vin;

void setup()
{
  Serial.begin(115200);
  vin = 0;
  output();
  vin = 123;
  output();
}

void loop()
{
}

void output()
{
  for (int x = 0; x <= 16; x++)
  {
    Serial.print(x);
    Serial.print("\t");
    Serial.println(vin, x);
  }
  Serial.println("---------------");
}

How many decimal places do you think that it will print as x increases from 0 to 16 ?

TolpuddleSartre:
Not sure about Ted, but ted certainly is.

I put that in the code and problem is gone

It's nothing to do with decimal places, it's number bases, though I'm not sure what will happen with base zero.

UKHeliBob:
As has been pointed out, in the code from post #34 vin is an int, and its value never changes after it is initialised to zero.

So, how could it be working right ?
How could it print 2 (or 3) decimal places when it is an int ?

Look at this.

int vin;

void setup()
{
 Serial.begin(115200);
 vin = 0;
 output();
 vin = 123;
 output();
}

void loop()
{
}

void output()
{
 for (int x = 0; x <= 16; x++)
 {
   Serial.print(x);
   Serial.print("\t");
   Serial.println(vin, x);
 }
 Serial.println("---------------");
}



How many decimal places do you think that it will print as x increases from 0 to 16 ?

This is in int
int vin;
and this in
lcd.print(vin, 2);

So what's the deal about printing in binary?

TolpuddleSartre:
It's nothing to do with decimal places, it's number bases, though I'm not sure what will happen with base zero.

It treats it as a write()

TolpuddleSartre:
So what's the deal about printing in binary?

Guys changed the subject because of no luck to original question

Have you considered that you might be part of the problem, along with the code?

State the problem clearly.
Post the code.
Post your observations about the behavior of the code.

Then listen and apply

TolpuddleSartre:
Have you considered that you might be part of the problem, along with the code?

State the problem clearly.
Post the code.
Post your observations about the behavior of the code.

Then listen and apply

Review OP's past posts. This is consistent. One term comes to mind: Time Sink.

TolpuddleSartre:
Have you considered that you might be part of the problem, along with the code?

State the problem clearly.
Post the code.
Post your observations about the behavior of the code.

Then listen and apply

Everything is there
Original code post #0
Modified code post #34
Test results post # 17/ 18

From the code in post 34

 lcd.print(vin, 3);

Is it important that you print this value in base 3?

Then there's this very obvious flaw.

  if(currState != prevState);

You've fixed that, right?

Please do your self the favour and try to look at what your code does and combine your findings with the answers you have gotten. You question has been solved multiple times, it is up to you to implement it.

Why are you assigning minVal to maxVal in the following code?

if(calibrating)
{
   if(theVal > maxVal)
      maxVal = minVal;
   if(theVal < minVal)
      minVal = theVal;
}

Why are you printing the unassigned value "vin" in the code below? And WHY WHY WHY wont you understand, that an integer HAS NO DECIMALS and the second parameter of "print()" HAS NOTHING TO DO WITH DECIMALS?

lcd.print(vin, 3);  // the extra parameter 2 indicates the decimals
lcd.print(" ");
lcd.print(minVal, 1);
lcd.print("-");
lcd.print(maxVal, 1);

Sorry for shouting, but it is just terribly annoying that you refuse to mind the suggestions given..

Why are you assigning minVal to maxVal in the following code?

That was probably my fat-fingered mistake.

Modified code post #34
Test results post # 17/ 18

Does it strike you as odd that your test results don't come from your most recent code?
Are you capable of thinking logically?

PaulS:
That was probably my fat-fingered mistake.

Even if so, it was OP who mindlessly copied it and that suggests that working, finished code is the only correct answer for OP.