AKJ7 / TM1637

TM1637 Library Driver for Microcontrollers
GNU General Public License v3.0
33 stars 11 forks source link

Count from right to left #12

Closed sdparkes66 closed 10 months ago

sdparkes66 commented 3 years ago

Not an issue really, just odd that the count fills from the left, I don't have the knowledge on how to have the numbers start on the rightmost digit (3) and fill across..

_0 00 _000 0000

Instead of

0 00 000 0000

if the functionality is there could you point me at it please.

AKJ7 commented 3 years ago

Hey, you can use the offset argument of the display() function.

tm1637.display(0, true, false, 3);

will generate ___0. Check the split_screen example. Unfortunately, you will need to set the offset for every value you will want to display. I will add an option for the next release to set the fill direction.

freescaping commented 11 months ago

Hi, not sure if I missed something, but I'm trying to get a sensor readout to display to 1 decimal place (anything more is unreadably fast or too old to be relevant) for example, if: output is 1.234, display _ _1.2 output is 12.34, display _12.3 output is 123.4, display 123.4 This way, the decimal is in a predictable position.

Everything I try seems to just pad the left by the same amount: 1.2 _12.3 _123

I did find another library, which only takes int, but is right justified, with individually controllable decimals. I'd prefer not to do that workaround, and I like the way your library is written. So if i missed it, can you show me how?

(PS: I'm fairly new to anything but TI Basic or Excel, 😂 just learned about complex operators, and libraries look like nonsense for me to reverse-engineer)

AKJ7 commented 11 months ago

Hey, sorry for the late message. Jo, understood. Adding customizable decimal position in the coming release. Thanks.

You can still first convert the number to string using the String library, then displaying it.

AKJ7 commented 10 months ago

Custom float decimal count has been added to #20. I might add the display direction in the next release.