Go Down

Topic: 4 digits TM1637 Red Digital Tube LED Display Module With Clock for Arduino guide (Read 2600 times) previous topic - next topic


I purchased on ebay, a 4 digit display and I wrote a guide while learning to use it. There is one thing I haven't figured out yet, is the center colon.

I have included my guide in PDF format and would like to get your input to complete it.

This code turns on the center colon, but I don't understand it.

Code: [Select]
segto = 0x80 | display.encodeDigit((cont / 100)%10);
 display.setSegments(&segto, 1, 1);

Complete program

Code: [Select]
#include <Arduino.h>
#include <TM1637Display.h>

// Module connection pins (Digital Pins)
#define CLK 9
#define DIO 8

// The amount of time (in milliseconds) between tests
#define TEST_DELAY   2000

int cont = 0;
TM1637Display display(CLK, DIO);

void setup()
 uint8_t data[] = { 0x0, 0x0, 0x0, 0x0 };


void loop()
 uint8_t segto;
 display.showNumberDec(cont, true);
 segto = 0x80 | display.encodeDigit((cont / 100)%10);
 display.setSegments(&segto, 1, 1);
 //if (++cont == 10000)
 //   cont = 0;


Thanks so much for this guide/info

I got the same display/board as you and I really wanted to use the colon as it's going to serve as a countdown timer switch, I was about to try find another display before I saw this.

As far as explaining that code 0x80 seems to represent the bit for the colon segment which is connected to digit 1 (second from left).

The first line of your code above combines that bit with the segment data (created by the encodeDigit function) of whatever integer is put in the brackets on the right.
All this data is written to whatever variable is on the left, segto in this case.

The second line simply prints this combined segment data to digit one.

It's kind of annoying that the authors of the libraries aren't putting that function in but i'm glad you've found it.


I have just add some code in library:
1) variable bool "m_colon" (show or not colon)
2) function setColon(bool colon)
3) condition "if m_colon == true" - add 0x80 bit to second digit

and there is example in sketch
Code: [Select]

    display.setColon(true); // just call this function for show central colon


I own the same module.
For me, the setBrightness() method only works for values higher than 7.
For values lower than 8, the display is off.

Do you guys see the same behavior on yours or is it just me/mine?

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131