unofficial reply to decimals on the LCD

Can’ t post to official robot C tech support from this one… @pvipadkid16 posted this…

I think you want to fill in a formatted string with the float value and then post that string to the LCD screen

Here are the LCD functions available to you.

I think you want to use displayLCDString() to display it. But you need to fill in a string first.

So take your float and pop it into a string!

Look at StringFormat(). You will have to replace the 3.14 with your desired value of num.

string str = "";                  // Create String, 'str' and initialize it as 'empty'.
float num = 3.14159;              // Create float, 'num' and initialize it as first 6 digits of pi.
StringFormat(str, "%1.2f", num);  /* Format num into a float to 2 decimal places, then send it to
                                     the string, 'str'.                                          */

Then take str value and plop it into the LCD.
So replace your code to have the string on the line which is a formatted float with 2 decimal positions shown (that’s the %1.2f up above)


Kind of convoluted but oh well…