Pages: [1]   Go Down
Author Topic: Limit number of characters used by lcd.  (Read 746 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 25
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

Central MN, USA
Offline Offline
Tesla Member
***
Karma: 75
Posts: 7260
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged


Portugal
Offline Offline
Edison Member
*
Karma: 37
Posts: 1593
Pretending you know everything then you will learn nothing.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Debian,Mint,Ubuntu
Arduino Mega 2560
Arduino Nano
Arduino Duemilanove
MAC OS Montain Lion
Raspberry PI Model B


Central MN, USA
Offline Offline
Tesla Member
***
Karma: 75
Posts: 7260
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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


Pages: [1]   Go Up
Jump to: