I have a float that I cannot .display (OLED library) with only 1 decimal. Is there a formatting syntax that should be used? I did not find it in the reference.
I tried to round it and then cast to a String to then .substring it but it does not work.
i.e. value is 5.80 I want to print 5.8
value = value.substring(1,value.lenght()-1); // extracting char fm 1 to 3???
I had already seen the reference for the Serial.print but that is just for debugging so no formatting is really needed … my problem is "printing" on the OLED with the .display function of the library Adafruit.
Has the - printableObject.print(value, 1); - any reference? Does it refer to the serial monitor printing? I am not sure I understood it.
This is why I was focusing on the manipulation of a string. I am also adding a suffix like $ or kOhm .. like I would do with a "formatting mask" in other programming environments or in Excel.
Tks
F
The Arduino core library provides a handy Print class that many libraries inherit from. Unfortunately, Arduino doesn't provide any generic documentation of this class, so each library that inherits from it must duplicate the documentation of the inherited functions (or in some cases not bother to document it at all). So you will find that the documentation for the Print class functions (write, availableForWrite, print, println) of Serial can be (loosely) applied to many other libraries.