I2C LCD causes problems

@KenH
Just a note to say that as you look at the documentation for the xxprintf() routines, and specifically the formatting characters and modifiers , you will see that they do support floating point number formatting.
However, the AVR has very limited code space resources (FLASH) so the AVR libC developers decided to create multiple libC libraries and the default one linked in does not have floating support in sprintf() to save some code space.
While you can change which library is linked in through link options the Arduino Arduino.cc development team has over and over again refused to support a way to link in the version that has floating support from the IDE, even when offered the code to update the IDE to allow options to support it directly from the IDE GUI.
There are ways to get the floating point version of AVR libC if you really want to, but most of them require modifications to the board.txt file or to the linker recipes in the platform.txt file to override/change the default linker settings.

This is some background as to why @groundFungus used dtostrf() to format IPS rather than sprintf()
It is because by default on the AVR platform, %f is not supported by sprintf()

Things are different for other platforms as they enable floating support in xxprintf() functions by default. On those you could use sprintf() to print out the floating point value of IPS.

Also, you were using a different board that used a 3rd party core, nearly all the 3rd party cores support a printf() method in the Print class.
For example, if you were using a board that uses the esp8266, ESP32, Teensy, Teensy3, chipkit, or STM platforms, to name few, you could use:

lcd.printf("%8.1f", IPS);

to print the value on the LCD instead of having to uset dtostrf() to format the characters in to a buffer and then print the buffer.

--- bill

1 Like