/*
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 set up
// *********************************************************************** //
//General variables
unsigned long numberToShow = 0;
// Variables for scoring
//int Score = 0; //0 to 990; //game score
//int HighScore = 0;
// Variables for time
//int TimeRemaining = 0; // Values 0 to 30
// *********************************************************************** //
void setup() {
// *********************************************************************** //
//Set up for seven segment displays
byte segDPins[] = {38, 39, 40, 41, 42, 43, 44}; // Segments A, B, C, D, E, F, G
byte ccDPins[] = {45, 46, 47, 48, 49, 50, 51, 52}; // Common cathodes for dispays 1, 2, 3, 4, 5, 6, 7, 8
sevSeg.begin(COMMON_CATHODE, 8, ccDPins, segDPins, false, false, false, true);
//sevSeg.setNumber (numberToShow, 0, LOW);
sevSeg.setBrightness(120); // Can range -200 to +200 with normal range 0 to 100
sevSeg.blank();
//Serial.begin(115200);
} //end set up
int Score = 321; // values 0 to 990
int HighScore = 654; // values 0 to 990
int TimeRemaining = 87; // Values 0 to 120
// *********************************************************************** //
void loop() {
// *********************************************************************** //
//numberToShow = TimeRemaining * pow(10, 6) +HighScore * pow(10, 3) + Score; // [2 digts time remaining][3 digits high score][3 digits score] = 8 digit number
numberToShow = TimeRemaining * 1000000UL + HighScore * 1000UL + Score; // [2 digts time remaining][3 digits high score][3 digits score] = 8 digit number
//Serial.println(numberToShow);
sevSeg.setNumber(numberToShow);
sevSeg.refreshDisplay();
} // End of loop ()