уторак, 28. јануар 2020.

Yet another one day build of a digital clock

So, what is the difference this time? I have used TM1637 four-digit, seven-segment display, instead of driverlesss display. The difference is in the number of components. Instead of having twelve resistors and four transistors to drive the 7-segment display, now I have a single display with the built-in driver.

The code is on github.

Here is the schematics:
When you compare that to my previous 4-digit 7-segment build, you will notice the difference. The code is simpler, too:

const int CLK = 17; //Set the CLK pin connection to the display
const int DIO = 16; //Set the DIO pin connection to the display

TM1637Display display(CLK, DIO); //set up the 4-Digit Display.

void setup() {

  //set the display brightness  (0x0a is max)
  display.setBrightness(0x05); 

  ...

}

void loop() {
  
  display.showNumberDec(hour_1*1000 + hour_2*100 + minute_1*10 + minute_2);

  toggle = ~toggle;
  if (toggle)
  {
    display.showNumberDecEx(hour_1*1000 + hour_2*100 + minute_1*10 + minute_2, (0x80 >> 1), true);
  } 
    delay(500);
}

This is the clock:



Нема коментара:

Постави коментар

Напомена: Само члан овог блога може да постави коментар.