Limit number of characters used by lcd.

I have an LCD wired up to my arduino, and I want it to display the value of a potentiometer. I don't however, want it to display decimal points. How can I get the arduino to not print more than a certain number of characters at a given time?

laptopman:
I have an LCD wired up to my arduino, and I want it to display the value of a potentiometer. I don't however, want it to display decimal points. How can I get the arduino to not print more than a certain number of characters at a given time?

I think the new trick with the latest arduino IDE is to do this:

lcd.print(float_number,number_of_digits)

The online reference has not been changed yet. Give it a try and see if you like it. There is always an alternative that can be as precise in output control as you can get with sprintf() you can learn on cplusplus.com

have you tried to just use a simple int variable?
int variables dont have decimal so the display will also wont print nothing :slight_smile:

OP might want to keep digits after the decimal but doesn't want all those digits the default lcd.print does.