DIYables 4-digit 7-segment Display LED TM1637 with colon for Arduino, ESP32, ESP8266, Raspberry Pi, 2 pieces
WHERE TO BUY
Shop now at Amazon.com |
DESCRIPTION
The package contains two 4-digit 7-segment Display LED TM1637 with a colon.
SPECIFICATION
- 2 pieces of 4-digit 7-segment LED display module
- A colon-shaped programable LED in the middle of module as a seperator
- Perfect for displaying time: hh:mm, mm:ss...
- 7-segment LED Display for Arduino, ESP32, ESP8266, Raspberry Pi, or any 5V or 3.3V microcontroller.
- Tutorials for Arduino is provided
TUTORIALS
Arduino Example Code
/*
* This code is created by DIYables.io
* This code is released in the public domain
* For more detail, visit https://diyables.io/products/4-digit-7-segment-display-led-tm1637-with-colon
*/
#include <TM1637Display.h>
// define the connections pins
#define CLK 9
#define DIO 10
// create a display object of type TM1637Display
TM1637Display display = TM1637Display(CLK, DIO);
unsigned long time_m = 12;
unsigned long time_s = 0;
unsigned long last_ms = 0;
void setup() {
Serial.begin(9600);
display.clear();
display.setBrightness(7); // set the brightness to 7 (0:dimmest, 7:brightest)
unsigned long time = time_m * 100 + time_s;
display.showNumberDecEx(time, 0b11100000, false, 4, 0);
}
void loop() {
if ((millis() - last_ms) >= 1000) {
time_s++;
time_m += time_s / 60;
time_s = time_s % 60;
unsigned long time = time_m * 100 + time_s;
display.showNumberDecEx(time, 0b11100000, false, 4, 0);
last_ms = millis();
Serial.println(last_ms);
}
}