Button to cycle through numbers in a 7 segment clock

I've been handed a 7-segment display with 4 digits that use a LED stripe for the segments. It was originally used as a stopwatch/timer at a school. The original maker passed away so it was handed to me to modify but I haven't coded anything in years so I'm really rusty. I've mashed together some codes but it's not working. I just want it to start with 0000 then 0550,1250,3050,5000 then back to 0000 and have them be able to start over again.

// INCLUDES
// Interfacing to programmable LED strips, see https://fastled.io/
#include <FastLED.h>
// For debouncing button input, see https://github.com/thomasfredericks/Bounce2
#include <Bounce2.h>

// DEFINES
// How many LEDs are used in each digit
#define NUM_LEDS_PER_DIGIT 29
// Total number of LEDs in the strip
#define NUM_LEDS 116
// The pin which is connected to the DataIn of the LED strip
#define DATA_PIN 2
// If defined, timer shows minutes and seconds MM:SS, rather than seconds SSSS
// #define DISPLAY_MMSS

// CONSTANTS
// The following array defines the sequence of LEDs that should be lit to represent each digit 0-9
// This will vary depending on the order in which the strip has been physically wired through
// the segments, the number of LEDs in each segment, whether there are any unused LEDs in the strip
// (e.g. between digits) etc.
// Segments of a 7-segment display are generally labelled as follows:
//    /-A-\
//    F   B
//    --G-/
//    E   C
//    \-D-/
// The way I've wired the strips is:
// - Strip is fed through the segments in the order G->B->A->F->E->D->C (then onto the next digit)
// - There are 4 LEDs in each segment
// - There is a single unused LED in the strip between segments F and E
// - This makes the total length of 29 LEDs in the strip for each digit
// - I'm packing these into a single 32-bit integer, and since bitwise operations are MSB, this will
// be counted from the right-hand side, and then padded at the front with 3x0s up to 32 bits.
// e.g. 0b000ccccddddeeee0ffffaaaabbbbgggg
const uint32_t digits[10] = {
  0b00011111111111101111111111110000, // 0
  0b00011110000000000000000011110000, // 1
  0b00000001111111100000111111111111, // 2
  0b00011111111000000000111111111111, // 3
  0b00011110000000001111000011111111, // 4
  0b00011111111000001111111100001111, // 5
  0b00011111111111101111111100001111, // 6
  0b00011110000000000000111111110000, // 7
  0b00011111111111101111111111111111, // 8
  0b00011111111000001111111111111111, // 9
};
// Input pins
const byte leftPin = 6;
const byte startPin = 5;
const byte rightPin = 4;

// GLOBALS
// The array of RGB values assigned to each LED in the strip
CRGB leds[NUM_LEDS];

int buttonPushCounter = 1;
int buttonState = 0;

// Bounce objects to read debounced button input
Bounce2::Button btnStart = Bounce2::Button();
Bounce2::Button btnLeft = Bounce2::Button();
Bounce2::Button btnRight = Bounce2::Button();

// FUNCTIONS
// Set the values in the LED strip corresponding to a particular display/value 
void setDigit(int display, int val, CHSV colour){
  for(int i=0;i<NUM_LEDS_PER_DIGIT; i++){
    colour.v = bitRead(digits[val], i) * 255;
    leds[display*NUM_LEDS_PER_DIGIT + i] = colour;
  }
}

// This function runs once when the program first starts
void setup() {

  // Initialise a serial connection, used only for debugging
  Serial.begin(115200);
  Serial.println(__FILE__ __DATE__);
 
// Initialise the LED strip
  FastLED.addLeds<WS2812B, DATA_PIN, GRB>(leds, NUM_LEDS);

  // Configure the debounced inputs
  btnStart.attach(startPin, INPUT_PULLUP);
  btnLeft.attach(leftPin, INPUT_PULLUP);
  btnRight.attach(rightPin, INPUT_PULLUP);
}
int buttonPress()
{
  buttonState = digitalRead(startPin);
  if (buttonState != lastButtonState)
  {
    if (buttonState == LOW)
    {
      buttonPushCounter++;
    }
    delay(50);
  }
  lastButtonState = buttonState;
  if(buttonPushCounter == 6)
  {
    buttonPushCounter = 1;
  }
}

// This function runs over and over
void loop() {

  // Check whether any buttons have been pressed
  btnStart.update();
  btnLeft.update();
  btnRight.update();
  // Calculate the value to be displayed
  static long timeValue = 0;
  // The colour hue in which the time will be displayed
  int timeHue = 170;
    switch (buttonPushCounter)
  {
    case 1:
      firstnumber();
      break;
    case 2:
      secondnumber();
      break;    
    case 3:
      thirdnumber();
      break;
    case 4:
      fourthnumber();
      break;
    case 5:
      restart();
      break;
  }
}
void firstnumber(){
    // Units
    setDigit(3, (0 ) % 10, CHSV(timeHue, 255, 255));
    // Tens
    setDigit(2, (5 ) % 10, CHSV(timeHue, 255, 255));
    // Hundreds
    setDigit(1, (5 ) % 10, CHSV(timeHue, 255, 255));
    // Thousands
    setDigit(0, (0 ) % 10, CHSV(timeHue, 255, 255));
    }
void secondnumber(){
    // Units
    setDigit(3, (0 ) % 10, CHSV(timeHue, 255, 255));
    // Tens
    setDigit(2, (5 ) % 10, CHSV(timeHue, 255, 255));
    // Hundreds
    setDigit(1, (2 ) % 10, CHSV(timeHue, 255, 255));
    // Thousands
    setDigit(0, (1 ) % 10, CHSV(timeHue, 255, 255));
    }
void thirdnumber(){
    // Units
    setDigit(3, (0 ) % 10, CHSV(timeHue, 255, 255));
    // Tens
    setDigit(2, (5 ) % 10, CHSV(timeHue, 255, 255));
    // Hundreds
    setDigit(1, (0 ) % 10, CHSV(timeHue, 255, 255));
    // Thousands
    setDigit(0, (3 ) % 10, CHSV(timeHue, 255, 255));
    }
void fourthnumber(){
    // Units
    setDigit(3, (0 ) % 10, CHSV(timeHue, 255, 255));
    // Tens
    setDigit(2, (0 ) % 10, CHSV(timeHue, 255, 255));
    // Hundreds
    setDigit(1, (0 ) % 10, CHSV(timeHue, 255, 255));
    // Thousands
    setDigit(0, (5 ) % 10, CHSV(timeHue, 255, 255));
    }
void restart(){
    // Units
    setDigit(3, (0 ) % 10, CHSV(timeHue, 255, 255));
    // Tens
    setDigit(2, (0 ) % 10, CHSV(timeHue, 255, 255));
    // Hundreds
    setDigit(1, (0 ) % 10, CHSV(timeHue, 255, 255));
    // Thousands
    setDigit(0, (0 ) % 10, CHSV(timeHue, 255, 255));
    }
{

    // Cycle colour hue while paused (BPM, from_value, to_value)
    timeHue = beatsin8(20, 0, 40);




  // Send the updated values to the LED strip
  FastLED.show();
 
  delay(20);
}

Please never say this. Always explain what it does and what you expected it to do.

Hi, @krunchee
Welcome to the forum.

Can you please post a schematic?
An image of a hand drawn schematic will be fine, include ALL power supplies, component names and pin labels.

What are the pinouts on the display?

You have told us what you want the code to do, now tell us what it is doing?

A picture of your project would be good too.

Thanks.. Tom.. :smiley: :+1: :coffee: :australia:

I think "doesn't work" means "does not compile".

When code does not compile, you should explain that and post the complete list of error messages inside code tags.

When you say "does not work" everyone will assume that the code compiles and uploads but does not behave as desired

You tried to define functions inside another function (loop() in this case) and that's not allowed in C.

Try this

// INCLUDES
// Interfacing to programmable LED strips, see https://fastled.io/
#include <FastLED.h>
// For debouncing button input, see https://github.com/thomasfredericks/Bounce2
#include <Bounce2.h>

// DEFINES
// How many LEDs are used in each digit
#define NUM_LEDS_PER_DIGIT 29
// Total number of LEDs in the strip
#define NUM_LEDS 116
// The pin which is connected to the DataIn of the LED strip
#define DATA_PIN 2
// If defined, timer shows minutes and seconds MM:SS, rather than seconds SSSS
// #define DISPLAY_MMSS

// CONSTANTS
// The following array defines the sequence of LEDs that should be lit to represent each digit 0-9
// This will vary depending on the order in which the strip has been physically wired through
// the segments, the number of LEDs in each segment, whether there are any unused LEDs in the strip
// (e.g. between digits) etc.
// Segments of a 7-segment display are generally labelled as follows:
//    /-A-\
//    F   B
//    --G-/
//    E   C
//    \-D-/
// The way I've wired the strips is:
// - Strip is fed through the segments in the order G->B->A->F->E->D->C (then onto the next digit)
// - There are 4 LEDs in each segment
// - There is a single unused LED in the strip between segments F and E
// - This makes the total length of 29 LEDs in the strip for each digit
// - I'm packing these into a single 32-bit integer, and since bitwise operations are MSB, this will
// be counted from the right-hand side, and then padded at the front with 3x0s up to 32 bits.
// e.g. 0b000ccccddddeeee0ffffaaaabbbbgggg
const uint32_t digits[10] = {
  0b00011111111111101111111111110000, // 0
  0b00011110000000000000000011110000, // 1
  0b00000001111111100000111111111111, // 2
  0b00011111111000000000111111111111, // 3
  0b00011110000000001111000011111111, // 4
  0b00011111111000001111111100001111, // 5
  0b00011111111111101111111100001111, // 6
  0b00011110000000000000111111110000, // 7
  0b00011111111111101111111111111111, // 8
  0b00011111111000001111111111111111, // 9
};
// Input pins
const byte leftPin = 6;
const byte startPin = 5;
const byte rightPin = 4;

const int numbers[5] = {0,550,1250,3050,5000};

// GLOBALS
// The array of RGB values assigned to each LED in the strip
CRGB leds[NUM_LEDS];

int buttonPushCounter = 0;
int buttonState = 0;

// Bounce objects to read debounced button input
Bounce2::Button btnStart = Bounce2::Button();
Bounce2::Button btnLeft = Bounce2::Button();
Bounce2::Button btnRight = Bounce2::Button();

// FUNCTIONS
// Set the values in the LED strip corresponding to a particular display/value 
void setDigit(int display, int val, CHSV colour){
  for(int i=0;i<NUM_LEDS_PER_DIGIT; i++){
    colour.v = bitRead(digits[val], i) * 255;
    leds[display*NUM_LEDS_PER_DIGIT + i] = colour;
  }
}

// This function runs once when the program first starts
void setup() {

  // Initialise a serial connection, used only for debugging
  Serial.begin(115200);
  Serial.println(__FILE__ __DATE__);
 
// Initialise the LED strip
  FastLED.addLeds<WS2812B, DATA_PIN, GRB>(leds, NUM_LEDS);

  // Configure the debounced inputs
  btnStart.attach(startPin, INPUT_PULLUP);
  btnLeft.attach(leftPin, INPUT_PULLUP);
  btnRight.attach(rightPin, INPUT_PULLUP);
}
int buttonPress()
{
  buttonState = digitalRead(startPin);
  if (buttonState != lastButtonState)
  {
    if (buttonState == LOW)
    {
      buttonPushCounter++;
    }
    delay(50);
  }
  lastButtonState = buttonState;
  if(buttonPushCounter == 5)
  {
    buttonPushCounter = 0;
  }
}

void displayNumber(int n){
    // Units
    setDigit(3, (n/1000) % 10, CHSV(timeHue, 255, 255));
    // Tens
    setDigit(2, (n/100) % 10, CHSV(timeHue, 255, 255));
    // Hundreds
    setDigit(1, (n/10) % 10, CHSV(timeHue, 255, 255));
    // Thousands
    setDigit(0, (n) % 10, CHSV(timeHue, 255, 255));
    }

// This function runs over and over
void loop() {

  // Check whether any buttons have been pressed
  btnStart.update();
  btnLeft.update();
  btnRight.update();
  // Calculate the value to be displayed
  static long timeValue = 0;
  // The colour hue in which the time will be displayed
  int timeHue = 170;

  displayNumber(number[buttonPushCounter]);

  // Cycle colour hue while paused (BPM, from_value, to_value)
  timeHue = beatsin8(20, 0, 40);

  // Send the updated values to the LED strip
  FastLED.show();
 
  delay(20);
}

@krunchee
Is the "old" code existing? If yes please post it.

I would organize the code in following steps:

  1. make the button reading working
  2. make the selection of operation mode working (should it be a timer or a stop watch?!?)
  3. make each operation mode working with a simple print out to serial
  4. finally - bring the result to the large display

Here is the layout it uses a Nano Board CH 340/ATmega+328P

I moved sections around and I get fewer compile errors now.

// INCLUDES
// Interfacing to programmable LED strips, see https://fastled.io/
#include <FastLED.h>
// For debouncing button input, see https://github.com/thomasfredericks/Bounce2
#include <Bounce2.h>

// DEFINES
// How many LEDs are used in each digit
#define NUM_LEDS_PER_DIGIT 29
// Total number of LEDs in the strip
#define NUM_LEDS 116
// The pin which is connected to the DataIn of the LED strip
#define DATA_PIN 2
// If defined, timer shows minutes and seconds MM:SS, rather than seconds SSSS
// #define DISPLAY_MMSS

// CONSTANTS
// The following array defines the sequence of LEDs that should be lit to represent each digit 0-9
// This will vary depending on the order in which the strip has been physically wired through
// the segments, the number of LEDs in each segment, whether there are any unused LEDs in the strip
// (e.g. between digits) etc.
// Segments of a 7-segment display are generally labelled as follows:
//    /-A-\
//    F   B
//    --G-/
//    E   C
//    \-D-/
// The way I've wired the strips is:
// - Strip is fed through the segments in the order G->B->A->F->E->D->C (then onto the next digit)
// - There are 4 LEDs in each segment
// - There is a single unused LED in the strip between segments F and E
// - This makes the total length of 29 LEDs in the strip for each digit
// - I'm packing these into a single 32-bit integer, and since bitwise operations are MSB, this will
// be counted from the right-hand side, and then padded at the front with 3x0s up to 32 bits.
// e.g. 0b000ccccddddeeee0ffffaaaabbbbgggg
const uint32_t digits[10] = {
  0b00011111111111101111111111110000, // 0
  0b00011110000000000000000011110000, // 1
  0b00000001111111100000111111111111, // 2
  0b00011111111000000000111111111111, // 3
  0b00011110000000001111000011111111, // 4
  0b00011111111000001111111100001111, // 5
  0b00011111111111101111111100001111, // 6
  0b00011110000000000000111111110000, // 7
  0b00011111111111101111111111111111, // 8
  0b00011111111000001111111111111111, // 9
};
// Input pins
const byte leftPin = 6;
const byte startPin = 5;
const byte rightPin = 4;

// GLOBALS
// The array of RGB values assigned to each LED in the strip
CRGB leds[NUM_LEDS];
int timeHue = beatsin8(20, 0, 40);
int buttonPushCounter = 1;
int buttonState = 0;
int lastButtonState = 0;
int buttonPress()
{
  buttonState = digitalRead(startPin);
  if (buttonState != lastButtonState)
  {
    if (buttonState == LOW)
    {
      buttonPushCounter++;
    }
    delay(50);
  }
  lastButtonState = buttonState;
  if(buttonPushCounter == 6)
  {
    buttonPushCounter = 1;
  }
};
// Bounce objects to read debounced button input
Bounce2::Button btnStart = Bounce2::Button();
Bounce2::Button btnLeft = Bounce2::Button();
Bounce2::Button btnRight = Bounce2::Button();

// FUNCTIONS
// Set the values in the LED strip corresponding to a particular display/value 
void setDigit(int display, int val, CHSV colour){
  for(int i=0;i<NUM_LEDS_PER_DIGIT; i++){
    colour.v = bitRead(digits[val], i) * 255;
    leds[display*NUM_LEDS_PER_DIGIT + i] = colour;
  }
}

// This function runs once when the program first starts
void setup() {

  // Initialise a serial connection, used only for debugging
  Serial.begin(115200);
  Serial.println(__FILE__ __DATE__);
 
// Initialise the LED strip
  FastLED.addLeds<WS2812B, DATA_PIN, GRB>(leds, NUM_LEDS);

  // Configure the debounced inputs
  btnStart.attach(startPin, INPUT_PULLUP);
  btnLeft.attach(leftPin, INPUT_PULLUP);
  btnRight.attach(rightPin, INPUT_PULLUP);
}


// This function runs over and over
void loop() {

  // Check whether any buttons have been pressed
  btnStart.update();
  btnLeft.update();
  btnRight.update();
  // Calculate the value to be displayed
  static long timeValue = 0;
  // The colour hue in which the time will be displayed
  int timeHue = 170;
    switch (buttonPushCounter)
  {
    case 1:
      firstnumber();
      break;
    case 2:
      secondnumber();
      break;    
    case 3:
      thirdnumber();
      break;
    case 4:
      fourthnumber();
      break;
    case 5:
      restart();
      break;
  }
}
void firstnumber(){
    // Units
    setDigit(3, (0 ) % 10, CHSV(timeHue, 255, 255));
    // Tens
    setDigit(2, (5 ) % 10, CHSV(timeHue, 255, 255));
    // Hundreds
    setDigit(1, (5 ) % 10, CHSV(timeHue, 255, 255));
    // Thousands
    setDigit(0, (0 ) % 10, CHSV(timeHue, 255, 255));
    }
void secondnumber(){
    // Units
    setDigit(3, (0 ) % 10, CHSV(timeHue, 255, 255));
    // Tens
    setDigit(2, (5 ) % 10, CHSV(timeHue, 255, 255));
    // Hundreds
    setDigit(1, (2 ) % 10, CHSV(timeHue, 255, 255));
    // Thousands
    setDigit(0, (1 ) % 10, CHSV(timeHue, 255, 255));
    }
void thirdnumber(){
    // Units
    setDigit(3, (0 ) % 10, CHSV(timeHue, 255, 255));
    // Tens
    setDigit(2, (5 ) % 10, CHSV(timeHue, 255, 255));
    // Hundreds
    setDigit(1, (0 ) % 10, CHSV(timeHue, 255, 255));
    // Thousands
    setDigit(0, (3 ) % 10, CHSV(timeHue, 255, 255));
    }
void fourthnumber(){
    // Units
    setDigit(3, (0 ) % 10, CHSV(timeHue, 255, 255));
    // Tens
    setDigit(2, (0 ) % 10, CHSV(timeHue, 255, 255));
    // Hundreds
    setDigit(1, (0 ) % 10, CHSV(timeHue, 255, 255));
    // Thousands
    setDigit(0, (5 ) % 10, CHSV(timeHue, 255, 255));
    }
void restart(){
    // Units
    setDigit(3, (0 ) % 10, CHSV(timeHue, 255, 255));
    // Tens
    setDigit(2, (0 ) % 10, CHSV(timeHue, 255, 255));
    // Hundreds
    setDigit(1, (0 ) % 10, CHSV(timeHue, 255, 255));
    // Thousands
    setDigit(0, (0 ) % 10, CHSV(timeHue, 255, 255));
    }

  // Send the updated values to the LED strip
  FastLED.show();
 
  delay(20);

My compile errors now show this

C:\Users\Adam\Downloads\Modular 7-Segment Display-20221025T221531Z-001\Modular 7-Segment Display\ModularLEDDisplay\ModularLEDDisplay.ino:195:3: error: 'FastLED' does not name a type
FastLED.show();
^~~~~~~
C:\Users\Adam\Downloads\Modular 7-Segment Display-20221025T221531Z-001\Modular 7-Segment Display\ModularLEDDisplay\ModularLEDDisplay.ino:197:8: error: expected constructor, destructor, or type conversion before '(' token
delay(20);
^

exit status 1

Compilation error: 'FastLED' does not name a type

Got it to work!

// INCLUDES
// Interfacing to programmable LED strips, see https://fastled.io/
#include <FastLED.h>
// For debouncing button input, see https://github.com/thomasfredericks/Bounce2
#include <Bounce2.h>

// DEFINES
// How many LEDs are used in each digit
#define NUM_LEDS_PER_DIGIT 29
// Total number of LEDs in the strip
#define NUM_LEDS 116
// The pin which is connected to the DataIn of the LED strip
#define DATA_PIN 2
#define BUTTON_PIN 5
// If defined, timer shows minutes and seconds MM:SS, rather than seconds SSSS
// #define DISPLAY_MMSS

// CONSTANTS
// The following array defines the sequence of LEDs that should be lit to represent each digit 0-9
// This will vary depending on the order in which the strip has been physically wired through
// the segments, the number of LEDs in each segment, whether there are any unused LEDs in the strip
// (e.g. between digits) etc.
// Segments of a 7-segment display are generally labelled as follows:
//    /-A-\
//    F   B
//    --G-/
//    E   C
//    \-D-/
// The way I've wired the strips is:
// - Strip is fed through the segments in the order G->B->A->F->E->D->C (then onto the next digit)
// - There are 4 LEDs in each segment
// - There is a single unused LED in the strip between segments F and E
// - This makes the total length of 29 LEDs in the strip for each digit
// - I'm packing these into a single 32-bit integer, and since bitwise operations are MSB, this will
// be counted from the right-hand side, and then padded at the front with 3x0s up to 32 bits.
// e.g. 0b000ccccddddeeee0ffffaaaabbbbgggg
const uint32_t digits[10] = {
  0b00011111111111101111111111110000, // 0
  0b00011110000000000000000011110000, // 1
  0b00000001111111100000111111111111, // 2
  0b00011111111000000000111111111111, // 3
  0b00011110000000001111000011111111, // 4
  0b00011111111000001111111100001111, // 5
  0b00011111111111101111111100001111, // 6
  0b00011110000000000000111111110000, // 7
  0b00011111111111101111111111111111, // 8
  0b00011111111000001111111111111111, // 9
};
// Input pins
//int BUTTON_PIN = 5;


// GLOBALS
// The array of RGB values assigned to each LED in the strip
CRGB leds[NUM_LEDS];
int timeHue = beatsin8(20, 0, 40);
int buttonPushCounter = 1;
int buttonState = 0;
int lastButtonState = 0;
int buttonPress()
{
  buttonState = digitalRead(BUTTON_PIN);
  if (buttonState != lastButtonState)
  {
    if (buttonState == LOW)
    {
      buttonPushCounter++;
    }
    delay(50);
  }
  lastButtonState = buttonState;
  if(buttonPushCounter ==6)
  {
    buttonPushCounter = 1;
  }
};
// Bounce objects to read debounced button input
Bounce2::Button button = Bounce2::Button();

// FUNCTIONS
// Set the values in the LED strip corresponding to a particular display/value 
void setDigit(int display, int val, CHSV colour){
  for(int i=0;i<NUM_LEDS_PER_DIGIT; i++){
    colour.v = bitRead(digits[val], i) * 255;
    leds[display*NUM_LEDS_PER_DIGIT + i] = colour;
  }
}

// This function runs once when the program first starts
void setup() {

  // Initialise a serial connection, used only for debugging
  Serial.begin(115200);
  Serial.println(__FILE__ __DATE__);
 
// Initialise the LED strip
  FastLED.addLeds<WS2812B, DATA_PIN, GRB>(leds, NUM_LEDS);

  // Configure the debounced inputs
  button.attach(BUTTON_PIN, INPUT_PULLUP);
  button.interval(5);
  button.setPressedState(LOW); 
}


// This function runs over and over
void loop() {

  // Check whether any buttons have been pressed
  button.update();
  // The colour hue in which the time will be displayed
  int timeHue = 170;
    switch (buttonPushCounter)
  {
    case 1:
      restart();
      break;
    case 2:
      firstnumber();
      break;
    case 3:
      secondnumber();
      break;    
    case 4:
      thirdnumber();
      break;
    case 5:
      fourthnumber();
      break;
  }
    FastLED.show();
 
  delay(20);
}
void firstnumber(){
    // Units
    setDigit(3, (0 ) % 10, CHSV(timeHue, 255, 255));
    // Tens
    setDigit(2, (5 ) % 10, CHSV(timeHue, 255, 255));
    // Hundreds
    setDigit(1, (5 ) % 10, CHSV(timeHue, 255, 255));
    // Thousands
    setDigit(0, (0 ) % 10, CHSV(timeHue, 255, 255));
    buttonPress();
    }
void secondnumber(){
    // Units
    setDigit(3, (0 ) % 10, CHSV(timeHue, 255, 255));
    // Tens
    setDigit(2, (5 ) % 10, CHSV(timeHue, 255, 255));
    // Hundreds
    setDigit(1, (2 ) % 10, CHSV(timeHue, 255, 255));
    // Thousands
    setDigit(0, (1 ) % 10, CHSV(timeHue, 255, 255));
    buttonPress();
    }
void thirdnumber(){
    // Units
    setDigit(3, (0 ) % 10, CHSV(timeHue, 255, 255));
    // Tens
    setDigit(2, (5 ) % 10, CHSV(timeHue, 255, 255));
    // Hundreds
    setDigit(1, (0 ) % 10, CHSV(timeHue, 255, 255));
    // Thousands
    setDigit(0, (3 ) % 10, CHSV(timeHue, 255, 255));
    buttonPress();
    }
void fourthnumber(){
    // Units
    setDigit(3, (0 ) % 10, CHSV(timeHue, 255, 255));
    // Tens
    setDigit(2, (0 ) % 10, CHSV(timeHue, 255, 255));
    // Hundreds
    setDigit(1, (0 ) % 10, CHSV(timeHue, 255, 255));
    // Thousands
    setDigit(0, (5 ) % 10, CHSV(timeHue, 255, 255));
    buttonPress();
    }
void restart(){
    // Units
    setDigit(3, (0 ) % 10, CHSV(timeHue, 255, 255));
    // Tens
    setDigit(2, (0 ) % 10, CHSV(timeHue, 255, 255));
    // Hundreds
    setDigit(1, (0 ) % 10, CHSV(timeHue, 255, 255));
    // Thousands
    setDigit(0, (0 ) % 10, CHSV(timeHue, 255, 255));
    buttonPress();
    }

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.