// 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++;
}