/*
* This ESP32 code is created by esp32io.com
*
* This ESP32 code is released in the public domain
*
* For more detail (instruction and wiring diagram), visit https://esp32io.com/tutorials/esp32-tm1637-4-digit-7-segment-display
*/
#include <TM1637Display.h>
#define CLK 22 // The ESP32 pin GPIO22 connected to CLK
#define DIO 23 // The ESP32 pin GPIO23 connected to DIO
// create a display object of type TM1637Display
TM1637Display display = TM1637Display(CLK, DIO);
// an array that sets individual segments per digit to display the word "dOnE"
const uint8_t papa[] = {
SEG_A | SEG_B | SEG_E | SEG_F | SEG_G, // P
SEG_A | SEG_B | SEG_C | SEG_E | SEG_F | SEG_G, // A
SEG_A | SEG_B | SEG_E | SEG_F | SEG_G, // P
SEG_A | SEG_B | SEG_C | SEG_E | SEG_F | SEG_G, // A
};
void setup() {
display.clear();
display.setBrightness(7); // set the brightness to 7 (0:dimmest, 7:brightest)
}
void loop() {
// show counter 0-9
int i;
for (i = 0; i < 10; i++) {
display.showNumberDec(i);
delay(500);
display.clear();
}
// displayed letters: dOnE
display.setSegments(papa);
delay(2000);
display.clear();
}