I2C LCD causes problems

It is updating every 500ms as it is doing exactly what you told it to do.

You have changed the code. It is not the same as what @groundFungus provided in post #27 and the changes you made are beyond just changing/eliminating curly braces.
Go back an look again at the code in post #27, look very closely.
Your code is different.
The code you have updates the display when 500ms passes and rpm is not equal to lastRPM.
rpm will never be equal to lastRPM since lastRPM is set to zero and never changes.
The code that @groundFungus provided in post #27 updated the display after 500ms passes but only updates the rpm field on the display if rpm changed and only updates ips field on the display if ips changed.
That isn't what your code does.

Why don't you use the code provided?
Why avoid the use of sprintf() and dtostrf() using those will save 4ms per field update as it avoids a setCursor() and writing 7 spaces to update a field on the display.
The fixed width fields also ensures that the numbers don't dance around in the field left to right as the numbers change size since they will be right adjusted vs left adjusted.

Or if you are going to change the code to not use sprintf() and dtostrf() , at least start with the code from post #27 and just change what is between the curly braces of each field update.
Just keep in mind that if you do updates without pre-formatting fixed width fields using sprintf() and dtostrf() the display updates will take longer do to the extra display writes.

--- bill

1 Like