Updating LCD screen only when a variable has changed

I'm building a "flowering drying machine" and its come up that I don't want to use the clear() function due to its flickering of the screen. I got the idea to use a similiar stratagy as using the millis() function to tell time, by making a list of variables and comparing them to themselves. But before i tear up my code with that hunk of verbiage, I'm just wondering if anyone knows how anyone else would do this trick?

that's exactly what they do, you think right

I would think "they" would write a library for this wouldn't they?

If you require a library, do so. But in general you do not need any library for it.

The principle is simple - store the previous value in a separate variable(for example old_value) and compare the current value with the previous one before displaying it on the screen. If these values are different, then the screen needs to be updated. Don't forget to store the changed value in the old_value variable.

You may want to add a bit of hysteresis so that the variable has to change by at least a certain amount before updating. For instance, it may make no sense to update the display on a 0.01% change.

Also you may not need to update the whole display, only the part that changes. Like if you have some permanent labels, don't write them every update. Use spaces to clear the part of the display that is to change, reset the cursor and write the new data.

The clear function takes quite some time when called.
As already told, rewrite only when a value is changed helps.
Place the cursor, entually some initial blanks, then the value maybe ending with some blank.
In other words, over write old data!

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.