# LCD shows 2 of the 3 numbers

I just started to work with lcd and i already have some troubles with it.
I tried the hello world from the examples and that worked perfectly.
Now i wanted to show the outputvalue of an potentiometer.
I have put it in the right place but it only shows two of the 3 numbers.
It goes from 0 to 90 and than 10. Does anyone know how to solve this?

#include <LiquidCrystal.h>

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

void setup() {

lcd.begin(16, 2);

lcd.print(“hello, world!”);
}

void loop() {
int outputvalue = map(sensorvalue, 1023, 0, 25, 0);

lcd.setCursor(0, 1);

lcd.print(millis()/1000);

lcd.setCursor(5, 1);
lcd.print(outputvalue);
}

Are you sure that you are getting the correct value for outputvalue after the map() function ? Try printing it on the Serial monitor to eliminate any problem with the LCD.

Look at the parameters for map(). Is 1023 the lowest input value that you expect and 0 the highest ?

it only shows two of the 3 numbers.

Why do you think that you will get 3 numbers out of map() when you are mapping the input into a range from 0 to 25 ?

map(sensorvalue, 1023, 0, 25, 0) will only return a value between 25 and 0. Why do you expect THREE numbers?

Ooh my mistake you are right. But i have another problem. When i go from 0 to 255 and back to 20, the third number stays on. Than you read 200 from the lcd. How do I get rid of this?

Print a space after everything you send to the screen

It works thanks for your help.

Remember you are painting onto the screen, nothing goes away until you paint over it.

AWOL: Print a space after everything you send to the screen

Make that 2 spaces in case it changes from 101 to 9.

Or maybe write a function to format the number passed to it with the appropriate number of spaces.