Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <SevSeg.h>
- SevSeg sevseg;
- void setup(){
- byte numDigits = 4;
- byte digitPins[] = {10, 11, 12, 13};
- byte segmentPins[] = {9, 2, 3, 5, 6, 8, 7, 4};
- bool resistorsOnSegments = true;
- bool updateWithDelaysIn = true;
- byte hardwareConfig = COMMON_CATHODE;
- bool updateWithDelays = false;
- bool leadingZeros = true;
- bool disableDecPoint = true;
- sevseg.begin(hardwareConfig, numDigits, digitPins, segmentPins, resistorsOnSegments,
- updateWithDelays, leadingZeros, disableDecPoint);
- sevseg.setBrightness(90);
- }
- void loop(){
- static unsigned long timer = millis();
- static int deciSeconds = 0;
- if (millis() - timer >= 100) {
- timer += 100;
- deciSeconds++;
- if (deciSeconds == 10000) {
- deciSeconds=0;
- }
- sevseg.setNumber(deciSeconds, 1);
- }
- sevseg.refreshDisplay(); // Must run repeatedly
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement