#include "SevSeg.h"
SevSeg sevseg; // Seven segment object
void setup() {
byte numDigits = 1; // Set to 1 for single-digit display
// Defines common pins while using multi-digit display.
// Left for single digit display
byte digitPins[] = {};
// Arduino pin connections in order: A, B, C, D, E, F, G, DP
byte segmentPins[] = {9, 8, 7, 6, 5, 4, 3, 2};
byte displayType = COMMON_CATHODE;
//‘false’ if resistors are connected to common pin
bool resistorsOnSegments = true;
//Initialize sevseg object.
sevseg.begin(displayType, numDigits, digitPins, segmentPins,
resistorsOnSegments);
sevseg.setBrightness(90);
}
void loop() {
//Display numbers 0-9 with 1 seconds delay
for(int i = 0; i <= 10; i++) {
if (i == 10) {
i = 0;
}
sevseg.setNumber(i);
sevseg.refreshDisplay();
delay(1000);
}
}