Main Site Documentation

Writing a message onto a display for a certain time period


I have a short program written which I would like to display text onto a display for 2 seconds when a button is pressed. Do far I have this code:

disp.SetCursor(0, 0);
disp.SetCursot(1, 0);

I imagined that this would hold the display values for 2 seconds but it does not, the Sensor Zeroed text just flashes up and then goes back to the original display value.

Any suggestions would be greatly appreciated.



Welcome to the forum.

Where is the code that removes the text from display?
With only this code the text:
should never disappear.


Yes, welcome to the forum.

Somewhere else in your code is something that is clearing the screen or over-writing what was there. The code you show should display text and then that thread will sleep for 2 seconds, and then whatever the next statement is will execute. So you have a second thread or a timer that is also displaying onto the screen and doing the over-writing.