so bit screwy using 16x2 lcd. want display temperature in following format (for example): 78.35 degrees.
i'm using dallas 1 wire thingy - , data using serial monitor. example, when open serial monitor, following: 78.35. perfect.
using 16x2 display, when use code: lcd.print(temperature), get: 78
now, realize, 16x2 display, have put own "." between first 2 (or three) digits, followed lcd.print(".") , last 2 digits.
my question, how last 2 digits variable "temperature"?
i envision code this:
and little degree symbol nice too!
thanks!
i'm using dallas 1 wire thingy - , data using serial monitor. example, when open serial monitor, following: 78.35. perfect.
using 16x2 display, when use code: lcd.print(temperature), get: 78
now, realize, 16x2 display, have put own "." between first 2 (or three) digits, followed lcd.print(".") , last 2 digits.
my question, how last 2 digits variable "temperature"?
i envision code this:
code: [select]
lcd.print("temp is: ");
lcd.print(temperature);
lcd.print(".");
lcd.print(temperature); // need last 2 digits of variable here
and little degree symbol nice too!
thanks!
quote
i want display temperature in following format (for example): 78.35 degrees.that's unrealistic sensor accurate +/- 0.5 degrees.
quote
i envision code this:why? i'd envision be:
code: [select]
lcd.print(temperature, 2); // assumes temperature float, gets printed 2 decimal places
Arduino Forum > Using Arduino > Programming Questions > 16x2 LCD formatting question
arduino
Comments
Post a Comment