DISCLAIMER: This video and product links on this website contain affiliate links with Amazon Associates Program. As an Amazon Associate I earn from qualifying purchases. When you click on a link I receive a small commission. This helps support the channel and allows me to continue to make videos like this. Thank you for the support!
You will need to install the libraries for the TM1637 Display into your Arduino’s IDE Libraries folder in order for the code to work. Details for this in the video.
// Author: Silverjoda
// 4/8/2015
// Edited By Chase’sWKshop
// 12/11/2018
// Target: Arduino
#include <TM1637Display.h>
// Module connection pins (Digital Pins)
#define CLK 6
#define DIO 7
// The amount of time (in milliseconds) between tests
#define TEST_DELAY 100
uint8_t data[] = { 0xff, 0xff, 0xff, 0xff };
TM1637Display display(CLK, DIO);
// Code uses external interrupt to count the incoming pulses.
volatile int counter = 0;
void setup() {
Serial.begin(9600);
display.setBrightness(0x0f);
attachInterrupt(0,count,RISING);
}
void loop() {
delay(10);
Serial.print(counter); // Counter
display.showNumberDec(counter, true); // Expect: 0000
delay(TEST_DELAY);
}
void count()
{
counter++;
}