/*
Sample code to test how to get a total of eight 7-digit diplays working together using the SevSeg Library.
Note the eight digits will be split up as follows: [2 digit time][3 digit high score][3digit score]
e.g. if there is 87 seconds AND high score is 654 AND score is 321 then the resulting number array would be 87654321
*/
#include <SevSeg.h> // Library for seven segment display
SevSeg sevSeg;
// Variables for scoring
uint16_t Score = 0; //0 to 990; //game score
uint16_t HighScore = 0;
// Variables for time
byte TimeRemaining = 0; // Values 0 to 30
void setup() {
byte segPins[] = {38, 39, 40, 41, 42, 43, 44}; // Segments A, B, C, D, E, F, G
byte digitPins[] = {45, 46, 47, 48, 49, 50, 51, 52}; // Common cathodes for digits 1, 2, 3, 4, 5, 6, 7, 8
sevSeg.begin(COMMON_CATHODE, 8, digitPins, segPins, true, false, false, true);
Score = 321; // values 0 to 999
HighScore = 654; // values 0 to 999
TimeRemaining = 87; // Values 0 to 99
} //end set up
void loop() {
char numberToShow[] = " ";
sprintf(numberToShow, "%2u%3u%3u", TimeRemaining, HighScore, Score); // [2 digts time remaining][3 digits high score][3 digits score] = 8 digit number
sevSeg.setChars (numberToShow);
sevSeg.refreshDisplay();
}