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

Example for setting dots in setDisplayToString? #13

Open
tekadept opened this issue Feb 6, 2021 · 1 comment
Open

Example for setting dots in setDisplayToString? #13

tekadept opened this issue Feb 6, 2021 · 1 comment
Assignees
Labels
question Further information is requested

Comments

@tekadept
Copy link

tekadept commented Feb 6, 2021

Hi is it possible you can provide an example for setting dots in setdisplay to string?
I see it takes a word for setting dots as second parameter, but I'm not sure how to work that.
Ie what do I send to make dot 3 and 5 on?

@maxint-rd maxint-rd self-assigned this Feb 14, 2021
@maxint-rd maxint-rd added the question Further information is requested label Feb 14, 2021
@maxint-rd
Copy link
Owner

maxint-rd commented Feb 14, 2021

Hello @tekadept , I will add a more descriptive example as soon as I can find the time.
The method setDisplayToString() accepts a second parameter to set the dots, just like the method setDisplayToDecNumber(),

The example TM16xx_setSegments shows on line #47 how the first four dots of the display are switched on, and the last four are switched off:
module.setDisplayToString("HALO1234", 0xF0);
That line probably should have some comment added.
The secondary parameter is a composite of a binary values, used to indicate for each digit if the dot should be on or off.

To compose such value you can use the hexadecimal notation as used above. You can also use binary notation:
module.setDisplayToString("HALO1234", B11110000);
Another alternative is to combine bit values using | and _BV(), (or use bit() in case your display has more than 8 digits):
module.setDisplayToString("HALO1234", _BV(7) | _BV(6) | _BV(5) | _BV(4));

So to conclude, for your example setting you could try this:
module.setDisplayToString("HALO1234", _BV(5) | _BV(3));
If the wrong dots light up, you may want to reverse the order.

BTW. the example TM1638_TM1637ex_two_modules uses various other methods to show some things, including the class TM16xxDisplay, which supports the familiar and easy to use Arduino print() function.

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