Register / Login  |  Desktop view  |  Jump to bottom of page

tcMenu Arduinio library » How to clear the display.

Author: chirrindulari
04/03/2021 19:13:55
Dear David.

In my project I would need to keep the SSD1306 display off (to not emit light at night) until some key is pressed. That would initalize a countdown and would clear the display when reaching zero. The countdown would initialize when some key is pressed.

Could you give me some reccomendations?

* Function to clear the display.
* Function to enable the display again.
* Function to be called on any touchpad key pressed.

Thanks in advance.
And thanks for the touch sensor keys implementation !!!!!!!

Author: davetcc
05/03/2021 08:20:43
What I would do is look at the documentation around taking over the display. Many of the examples also take over the display too, so it's easy to work out how to do it.

Once you have control of the display you can call any function on the display yourself, but you should only do so in the rendering callback or instance of CustomDrawing that you provide to the renderer.

Both the OO - CustomDrawing and functional - renderingCallback methods are fully documented here, and again can be found in many examples. In the examples we usually make the menu take back over when the button is pressed, but you could also detect any change in the rotary encoder too, so then any button would wake it up. Of course, you could also do it many different ways as well, but I think this would be easiest.

Documentation for take over display:

https://www.thecoderscorner.com/products/arduino-libraries/tc-menu/renderer-take-over-display/

Also take a look at the examples, EG:

https://github.com/davetcc/tcMenuLib/blob/6b049aaa2e9ad4c8a3035280c28185aa812c892b/examples/takeOverDisplay/takeOverDisplay.ino#L191

Author: chirrindulari
05/03/2021 09:34:03
Thanks Dave (sorry for calling you David before)




Register / Login  |  Desktop view  |  Jump to top of page