Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using 4 and 6 digit displays at the same time #23

Open
jasonacox opened this issue Aug 31, 2022 · 4 comments
Open

Using 4 and 6 digit displays at the same time #23

jasonacox opened this issue Aug 31, 2022 · 4 comments
Labels
question Further information is requested

Comments

@jasonacox
Copy link
Owner

jasonacox commented Aug 31, 2022

Question from @Kravatox

I have another question, in my code I use two display, one with 4 digits and another with 6 digits, and when I include TM1637TinyDisplay.h library and TM1637TinyDisplay6.h I have this error : "warning: "MAXDIGITS" redefined" and "warning: "FRAMES" redefined". Is there any solution to use both library the same time ?

@jasonacox
Copy link
Owner Author

Hi @Kravatox

I am moving this into a new issue to address your question. Yes, you can use both. Here is a code snip from my Powerwall-Display project that uses two 4-digit displays and one 6-digit display.

#include <TM1637TinyDisplay6.h>
#include <TM1637TinyDisplay.h>

TM1637TinyDisplay display1(CLK1, DIO1);   // Solar
TM1637TinyDisplay6 display3(CLK2, DIO2);  // Power for Grid, House, Bat
TM1637TinyDisplay display2(CLK3, DIO3);   // Battery Level

@jasonacox jasonacox added the question Further information is requested label Aug 31, 2022
@CaptainSMan
Copy link

Is it possible to share the one CLK pin for say two 6digit displays?

@jasonacox
Copy link
Owner Author

That is possible. However, as you update one display, it is unknown what will happen to the the other display. It is possible that it will zero out even with no DIO toggles. Let us know if you try it out.

Alternatively, you could create a new class that manages two displays and update both displays at the same time using a shared CLK.

  • Update writeByte() to receive both display A and B byte and write at same time
  • Update writeBuffer() to send both display buffers to writeByte()

I don't think it would be too difficult. If you or anyone else wants to attempt adding this new class, I would be happy to accept a PR to add it to the library.

@CaptainSMan
Copy link

Thanks Jason.
I have kept them separate for now in the interest of getting my project up and running, might revisit this in the next iteration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants