How to stop changes ?

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);