#include <SevSegShift.h>
const int dataPin = 11; // DS (data) pin for the segment shift register
const int clockPin = 12; // SHCP (shift clock) pin for the shift register
const int latchPin = 8; // STCP (storage clock) pin for the shift register
SevSegShift sevseg(dataPin, clockPin, latchPin);
void setup() {
byte numDigits = 1;
byte digitPins[] = {6}; // One digit pin connected to Arduino
byte segmentPins[] = {}; // Segment pins are managed by the shift register
bool resistorsOnSegments = true; // Set true if resistors are on segment lines
bool updateWithDelays = false; // Option to update with delays
bool leadingZeros = false; // Option to disable leading zeros
bool disableDecPoint = true; // Disable decimal point
sevseg.begin(COMMON_ANODE, numDigits, digitPins, segmentPins, resistorsOnSegments, updateWithDelays, leadingZeros, disableDecPoint);
sevseg.setBrightness(90);
}
void loop() {
for (int i = 0; i < 10; i++) {
sevseg.setNumber(i);
sevseg.refreshDisplay();
delay(500); // Delay to make the counting visible
}
}