How can limit some value of type float to be printed on LCD only 1 character after the comma?
float temperatureC = (voltage - 0.5) * 100 ;
lcd.print(temperatureC); // Here I want to be displayed only 1 character after the comm XX,X
How can limit some value of type float to be printed on LCD only 1 character after the comma?
float temperatureC = (voltage - 0.5) * 100 ;
lcd.print(temperatureC); // Here I want to be displayed only 1 character after the comm XX,X
The LiquidCrystal class is derived from the core Print class. See Footnote.
As of arduino-0018, a Print function call for a float argument can take the form of
objectname.print(float_value, n);
Where n is the number of decimal digits to be printed after the decimal point.
If you want to print with a comma instead of a decimal point, you can modify arduino-0018/hardware/arduino/cores/arduino/Print.cpp to make it so.
Regards,
Dave
Footnote:
If you are using something other than the LiquidCrystal class supplied with version 0018 of Arduino, and this does not work, you should tell us what class you are using.