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

Decimal dot #1

Open
silverchair opened this issue Feb 10, 2016 · 24 comments
Open

Decimal dot #1

silverchair opened this issue Feb 10, 2016 · 24 comments

Comments

@silverchair
Copy link

Hello,
the library is pretty cool, but is it possible to display decimal dot? Thanks in advance.

@bremme
Copy link
Owner

bremme commented Feb 10, 2016

Unfortunately, this is not possible. When sending a character to the display there is only one bit to set the colon (two dots), so there is no way to set only the lower dot of the colon. For more information see: SevenSegmentTM1637.h

// SevenSegmentTM1637 low level methods (use when you know what you're doing)
/* Prints raw (encoded) bytes to the display

  •     A
    
  •   ___
    
  • * F | | B
  • X -G-
  • * E | | C
  •   ___
    
  •    D
    
  • Bit: 76543210
  • Segment: XGFEDCBA
    *
  • For example to print an H, you would set bits BCEFG, this gives B01110110 in binary or 118 in decimal or 0x76 in HEX.
  • Bit 7 (X) only applies to the second digit and sets the colon

Nice, that you like the library!:)

@bremme bremme closed this as completed Feb 10, 2016
@bremme bremme reopened this Feb 10, 2016
@yucelll
Copy link

yucelll commented Jul 12, 2016

hello. this library the best library in the all tm1637. basic and fun!
But i dont show "dot"

and i am little known arduino.
i using lm35 and tm1637
i want see on the display: " 25.60 "

and later i want see " 25.6° "

please help me! thanks.

edit___and start arduino and "on" blinking? how much off blink ?

@bremme
Copy link
Owner

bremme commented Nov 14, 2016

I'm working on a major upgrade for the library which will have better support for the things you mention. I just tested with the Robodyne displays and found out that these displays allow to set the lower and upper dot of the colon separately. The upper colon is set by setting bit 7 of digit 3 and the lower colon is set by setting bit 7 of digit 4. You should be able to set the colon's by using the printRaw function.

To print for example 25.60 on the TM1637 Robodyne display you would use:

byte  rawData[4];
rawData[0] = display.encode('2');
rawData[1] = display.encode('5');
rawData[2] = display.encode('6') ;
rawData[3] = display.encode('0') | B10000000; // set the lower colon, bit 7 on digit 4
display.printRaw(rawData);

To print the degree symbol, you need to set segment A, B, G and F of the last digit. This can be done by:

// same as previous example, only now we set the 4th digit to the degree symbol
rawData[3] = B01100011 | B10000000; // set the lower colon, bit 7 on digit 4
display.printRaw(rawData);

@hectorlee
Copy link

I'm using the Robodyn display but it doesn't seem to be able to control the upper and lower colon separately. I'm using one with green 7 segment displays.

This is the code for controlling the colon on mine.

rawData[0] = display.encode('2');
rawData[1] = display.encode('5') | B10000000; // turn on the colon
rawData[2] = display.encode('6') ;
rawData[3] = display.encode('0');
display.printRaw(rawData);

I'm actually most interested in the decimal point on the individual digits can be controlled. Do you think this is possible? The TM1637 should have sufficient pins to do so.

@julienbrunet
Copy link

julienbrunet commented Dec 7, 2016

Same here, I bought those sepcific RobotDyn displays because of their decimal dot
But after reading more carefully the description on aliexpress, it says the decimal dot is not active...

And i'm also not able to control the upper / lower colon separately :(

@bremme
Copy link
Owner

bremme commented Dec 8, 2016

I believe the decimal dots are not wired to the chip on these RoboDyne displays. I have a red version at my desk and this one can display the upper and lower colon by setting the 7th bit (counting from zero). I noticed that I made a typo in my previous post (B1000000 vs B10000000). I just tested it again and it does work on my display:

img_20161208_014808

This is the code I used:

  byte  rawData;
  display.print("256");
  // display degree symbol on position 3 plus set lower colon
  rawData = B11100011;
  display.printRaw(rawData, 3);

@hectorlee
Copy link

I guess there might be a difference in the hardware that RobotDyn makes. I loaded your code and this is what I get.

img_9358

Are you able to control turning on both semi-colon with bit 7 of the second digit? This is the code for turning both parts of the semi-colon.

  display.print("256");
  // display degree symbol on position 3 plus set lower colon
  rawData = B11100011;
  display.printRaw(rawData, 3);

@dterweij
Copy link

Hi, I moved to this library because it is a much better (and cooler) one.
Just how to do a "27.3C"?
String temperature = "27.32"; (tho making it a int is no problem)
Maybe using a rouding math for the 4th digit of my string? so .32 becomes .3 and .37 becomes .4 ?
And using the colon for a dot.

@dterweij
Copy link

Got it on my own:
int disptemp = 29.09
newTemp makes it 29.1
then times 100 makes 291
set colon on and degree symbol

Hope it helps someone else too.

    float newTemp = disptemp / 10.0; // rounding decimal
    disptemp = newTemp * 100;    
    byte rawData;
    rawData = B01100011;
    display.setColonOn(1);
    display.print(disptemp);
    display.printRaw(rawData,3);

@techi602
Copy link

techi602 commented Mar 19, 2017

I also thought that the robotdyne display features decimal points per digit, but unfortunetly it does not:

This is a basic 4-digit 7-segment display module (GREEN). The display features double points in midle. The decimal point per digit not active.
Module connecting to digital I/O on 2 pins.
For Arduino use library: TM1637.h

http://robotdyn.com/catalog/segment/4_digit_led_display_tube_7_segments/

@Highcooley
Copy link

@ybaransky
Copy link

Bram (or anyone) - how can you tell which of the TM1637 based 4-digit LED's are enabled for decimal point or colon functionality? I purchased
https://www.ebay.com/itm/112674024638?ul_noapp=true
thinking it would support both. Looks like it only supports colon mode. I was hoping there would be a way to set the board up in colon or dp mode via software. Does not look good. Thx -yurij

@mrkale
Copy link

mrkale commented Apr 3, 2018

It is written in the name of the product "LED Clock Tube". On more serious pages it is exactly written in the product specification, that a decimal point is not active.
It is not necessary to vary a library. The colon is active just for active 7 segment (counting from 0, a.k.a. DP) of the second tube no. 1 (counting from 0). Decimal points of other tubes (digits) do not display even if their DP segment is activated. It is up to you to proper format the displayed data.

@ybaransky
Copy link

ybaransky commented Apr 3, 2018 via email

@mrkale
Copy link

mrkale commented Apr 3, 2018 via email

@ybaransky
Copy link

ybaransky commented Apr 3, 2018 via email

@gonzabrusco
Copy link

@av4625
Copy link

av4625 commented Jul 29, 2018

If you get the colon one from robotdy can you just turn on the bottom dot? Will you support the decimals one at some point?

@heatvent
Copy link

heatvent commented Oct 1, 2018

Hi, another person asking if decimals will be supported? If not, is it possible to use the TM1637Display library for decimal numbers (which it supports) and also use your library for the many other cool features!

@heatvent
Copy link

heatvent commented Oct 16, 2018

Is there possibly a way to force decimals to work with this library. I noticed the following in the sevensegmenttm1637.h file...

#define TM1637_COLON_BIT B10000000

very similar to the TM1637Display.h library for the showNumberDecEx function...

> Dispalyes the given argument as a decimal number. The dots between the digits (or colon)
>   //! can be individually controlled
>   //!
>   //! @param num The number to be shown
>   //! @param dots Dot/Colon enable. The argument is a bitmask, with each bit corresponding to a dot
>   //!        between the digits (or colon mark, as implemented by each module). i.e.
>   //!        For displays with dots between each digit:
>   //!        * 0.000 (0b10000000)
>   //!        * 00.00 (0b01000000)
>   //!        * 000.0 (0b00100000)
>   //!        * 0.0.0.0 (0b11100000)
>   //!        For displays with just a colon:
>   //!        * 00:00 (0b01000000)
>   //!        For displays with dots and colons colon:
>   //!        * 0.0:0.0 (0b11100000)
>   //! @param leading_zero When true, leading zeros are displayed. Otherwise unnecessary digits are
>   //!        blank
>   //! @param length The number of digits to set. The user must ensure that the number to be shown
>   //!        fits to the number of digits requested (for example, if two digits are to be displayed,
>   //!        the number must be between 0 to 99)
>   //! @param pos The position least significant digit (0 - leftmost, 3 - rightmost)
>   void showNumberDecEx(int num, uint8_t dots = 0, bool leading_zero = false, uint8_t length = 4, uint8_t pos = 0);

Sample code from TM1637Test.ino that turns on all the dots in sequence using the TM1637Display.h library...

for(k=0; k <= 4; k++) {
	display.showNumberDecEx(0, (0x80 >> k), true);
	delay(TEST_DELAY);
}

I think the code above is just using B10000000 and moving the 1 over 5 times (not sure why 5).

Using B10000000 as the definition of TM1637_COLON_BIT turns on the middle decimal. Using B01000000 turns on the number 8 on the second digit so I am thinking there is something about which position that needs to be figured out.

I am bit / byte illiterate so I am wondering if there is a way to change the definition of TM1637_COLON_BIT or to send a raw command to control the decimal of choice.

Thank you

@heatvent
Copy link

OK, I tracked down the code that controls the colon and basically the logic printraw changes a bit on whatever you are sending to the left of the colon position. I forked the code at https://github.com/heatvent/arduino-tm1637 and added (hacked) some code to control the decimal. Not sure if I have this working correctly and decimals really need some logic depending on if you want to show x number of decimal places, just one of the decimals to light up, have the decimal move with the number being shown (0.01 and 0.001 vs 0.010 and 0.001). If something like this could get integrated into the master that would be great, otherwise this is working for me for now.

@volodymyr-sevastianov
Copy link

OK, I tracked down the code that controls the colon and basically the logic printraw changes a bit on whatever you are sending to the left of the colon position. I forked the code at https://github.com/heatvent/arduino-tm1637 and added (hacked) some code to control the decimal. Not sure if I have this working correctly and decimals really need some logic depending on if you want to show x number of decimal places, just one of the decimals to light up, have the decimal move with the number being shown (0.01 and 0.001 vs 0.010 and 0.001). If something like this could get integrated into the master that would be great, otherwise this is working for me for now.

DAAAAAMN, man, you made my day. THANKS!!!

@JensGrabner
Copy link

You can find here ? -- https://github.com/avishorp/TM1637

@nuxeh
Copy link

nuxeh commented May 16, 2022

Here is another lib with decimal support https://github.com/jasonacox/TM1637TinyDisplay

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests