title: How to implement a clock with the TM1637 and colons which blink every second?
body: <p>I would like to implement a clock with an ESP-32 and a TM1637 4-digit display. My code at this moment works just fine, but when the clock reaches 23:00 it still shows 22 for the hour. And when I let the clock running until it reaches 24 o'clock the Display all Segments light up.</p>
  
  <p>Here is my code:</p>
  
  <pre class="lang-cpp prettyprint-override"><code>//...
  
  String timeStamp;
  unsigned long timeNow = 0;
  unsigned long timeLast = 0;
  int hours;
  int minutes;
  int seconds;
  int value = 1244;
  uint8_t colonOn = 0x80 | display.encodeDigit((value / 100)%10);
  uint8_t colonOff = 0x00 | display.encodeDigit((value / 100)%10);
  
  //...
  
  display.setBrightness(8);
  uint8_t data[] = { 0xff, 0xff, 0xff, 0xff };
  display.setSegments(data);
  
  </code></pre>
  
  <p>Here is my loop-function:
  First some setups</p>
  
  <pre class="lang-cpp prettyprint-override"><code>void loop()
  {
      timeNow = millis()/1000;
      seconds = timeNow - timeLast;
  
      if ((timeNow % 2) == 0) {
          display.setSegments(&amp;colonOn, 1, 1);  // Turns the colon on
      } else {
          display.setSegments(&amp;colonOff, 1, 1); // Turns the colon off
      }
  
      if (seconds == 60) {
          timeLast = timeNow;
          minutes += 1;
          display.showNumberDec(minutes, true, 2, 2);
      }
  
      if (minutes == 60) {
          minutes = 0;
          hours += 1;
          display.showNumberDec(minutes, true, 2, 2);
          display.showNumberDec(hours, true, 2, 0);
      }
  
      if (hours == 24) {
          hours = 0;
          resetFunc(); // call the resetFunction so the microcontroller restarts
      }
  
      delay(990);
  }
  </code></pre>
  
  <p>What I have figured out is that setting the colon with the following code implements this problem: 
  <code>display.setSegments(&amp;colonOn, 1, 1);</code>
  Without this line the clock seems to work probably, but then the colon doesn't show up every second</p>