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

tcMenu Arduinio library » Multiple display instances.

Author: DeeEmm
02/12/2019 11:51:59
Is it possible to run multiple displays?

Specifically I want to run three displays, one 4x20 LCD display over I2c and two additional 4 by 7 seg displays, also on I2C

What's the best way to go about this?

Thanks in advance

Author: davetcc
02/12/2019 15:27:14
Yes, this is a usecase that's already been considered. There's two ways to do it. First, you could modify the liquid crystal plugin that's copied into your project to add support for the extra displays, this is covered in the below link:

https://www.thecoderscorner.com/products/arduino-libraries/tc-menu/customise-menu-input-display-plugin/

Second, if the second display were only rendering a specific menu item you could just separately manage this yourself. You could register a callback for changes if needed and then in the callback render the change to your other display.

Don't forget you can get hold of the value of a menu item at any item using the getter function, for example on an AnalogMenuItem called analogMenu we could do something along the lines of:

void onAnalogMenuChange(int id) {
   int val = analogMenu.getCurrentValue();
   my4SegDisplay.print(val);
}


You can see more details of that at this url: https://www.thecoderscorner.com/products/arduino-libraries/tc-menu/tcmenu-menu-item-types-tutorial/.

There's also the library reference guide, linked on the top right of the above page.

Author: DeeEmm
10/12/2019 14:58:42
Thanks Dave.

For my use case I just want to display a value on overhead display (actually two 4x7segment displays), they do not even need to be able to handle menu functions, just display one variable. Menus and control are are taken care of via another 4x20 character display.

I think that it should be easy enough to do by managing it myself.

I'm thinking that I would just need to create another instance ( or two ) of the display driver class and then write directly to the display bypassing the menu functions.


Author: davetcc
11/12/2019 15:18:17
Yes if I were to do that, I would not create a new rendering class.

I would just create callback functions on the menu items to capture updates, then in those functions I would update each of the displays with the value of the menu item. There should be similar code in the packaged examples - albeit writing to serial. Just replace this with code to write to the additional display.




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