//Volleyball Scoreboard
//by Marcelo Morgantini 2023
#include "SevSeg.h"
int contador = 0;
SevSeg timeA; //Instantiate a seven segment controller object
SevSeg timeB;
SevSeg setA;
SevSeg setB;
void setup() {
pinMode (A0,OUTPUT);
pinMode (A1,OUTPUT);
pinMode (A2,OUTPUT);
pinMode (A3,OUTPUT);
pinMode (A4,OUTPUT);
pinMode (A5,OUTPUT);
pinMode (A6,OUTPUT);
pinMode (A7,OUTPUT);
pinMode (2,OUTPUT);
pinMode (3,OUTPUT);
pinMode (4,OUTPUT);
pinMode (5,OUTPUT);
pinMode (6,OUTPUT);
pinMode (7,OUTPUT);
pinMode (8,OUTPUT);
pinMode (9,OUTPUT);
pinMode (10,OUTPUT);
pinMode (11,OUTPUT);
pinMode (12,OUTPUT);
pinMode (13,OUTPUT);
byte digitosA = 2;
byte digitosB = 2;
byte digitosIdA[] = {A0, A1}; //A0 e A1 Placar A +++ A2 e A3 Placar B +++ A4 Sets A +++ A5 Sets B
byte digitosIdB[] = {A2, A3};
byte digitosPortasA[] = {2, 3, 4, 5, 6, 7, 8, 9, 10}; //A, B, C, D, E, F e G
byte digitosPortasB[] = {2, 3, 4, 5, 6, 7, 8, 9, 10}; //A, B, C, D, E, F e G
bool resistorsOnSegments = false;
byte hardwareConfig = COMMON_ANODE;
bool updateWithDelays = false;
bool leadingZeros = false;
bool disableDecPoint = true;
timeA.begin(hardwareConfig, digitosA, digitosIdA, digitosPortasA, resistorsOnSegments,
updateWithDelays, leadingZeros, disableDecPoint);
timeA.setBrightness(85);
timeB.begin(hardwareConfig, digitosB, digitosIdB, digitosPortasB, resistorsOnSegments,
updateWithDelays, leadingZeros, disableDecPoint);
timeA.setBrightness(85);
}
void loop() {
static unsigned long tempo = millis();
//static int contador = 0;
if (millis() - tempo >= 500) {
tempo += 300;
contador++;
if (contador == 25) {
contador = 0;
}
timeA.setNumber(contador, 1);
//timeB.setNumber(contador, 1);
}
timeA.refreshDisplay();
//timeB.refreshDisplay();
}
/*
Copyright 2017 Dean Reading
#include "SevSeg.h"
SevSeg sevseg; //Instantiate a seven segment controller object
void setup() {
byte numDigits = 4;
byte digitPins[] = {2, 3, 4, 5};
byte segmentPins[] = {6, 7, 8, 9, 10, 11, 12, 13};
bool resistorsOnSegments = false;
byte hardwareConfig = COMMON_CATHODE;
bool updateWithDelays = false;
bool leadingZeros = false;
bool disableDecPoint = true;
sevseg.begin(hardwareConfig, numDigits, digitPins, segmentPins, resistorsOnSegments,
updateWithDelays, leadingZeros, disableDecPoint);
sevseg.setBrightness(85);
}
void loop() {
static unsigned long tempo = millis();
static int contador = 0;
if (millis() - timer >= 500) {
timer += 500;
contador++;
if (contador == 8888) {
contador=0;
}
sevseg.setNumber(contador, 1);
}
sevseg.refreshDisplay();
}*/