[Logo] TCC discussion forum
  [Search] Search   [Recent Topics] Recent Topics   [Hottest Topics] Hottest Topics   [Top Downloads] Top Downloads   [Groups] Back to home page 
[Register] Register /  [Login] Login 


This forum is read only and new users cannot register, please ask all new questions either using GitHub discussions, or in Arduino forum tagging @davetcc.

Multiple display instances. RSS feed
Forum Index » tcMenu Arduinio library
Author Message
DeeEmm


Joined: Nov 28, 2019
Messages: 13
Offline
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
davetcc


Joined: Jan 19, 2019
Messages: 686
Offline
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.
DeeEmm


Joined: Nov 28, 2019
Messages: 13
Offline
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.

davetcc


Joined: Jan 19, 2019
Messages: 686
Offline
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.
 
Forum Index » tcMenu Arduinio library
Go to:   
Mobile view
Powered by JForum 2.7.0 © 2020 JForum Team • Maintained by Andowson Chang and Ulf Dittmer

This site uses cookies to analyse traffic, serve ads by Google AdSense (non-personalized in EEA/UK), and to record consent. We also embed Twitter, Youtube and Disqus content on some pages, these companies have their own privacy policies.

Our privacy policy applies to all pages on our site

Should you need further guidance on how to proceed: External link for information about cookie management.