Assistance needed for Arduino Uno R3 - scoreboard sketch

I am new to writing code and asking for assistance. My sketch uses a modified scoreboard code (public domain) from Brainy-Bits.com.I am using an UNO, but ultimately will use a NANO.
My goal is as follows—My scoreboard has a single, 8 digit, 7-segment display driven by Max7219 chip. The rightmost 4 digits are used for a “BONUS” . The leftmost four digits are used for “SCORE”. Sequence is as follows:
When “holeState1”is HIGH, I place a “100” in Bonus and begin countdown.
When “holeState2 is HIGH, the current “BONUS” value needs to be moved to “SCORE” and the new “BONUS” value is set to “200” and begins countdown.
When “holeState3 is HIGH, the current “BONUS” value needs to be moved AND ADDED to “SCORE” and the new “BONUS” value is set to “300” and begins countdown. This continues with “holeState4” = 400, holeState5 = 500 etc, until “holeState10” = 1000 and added to “SCORE”. At this point no more countdown. We’re done.
Right now, I can get the BONUS score for each “holeState(x), copied into “BONUS”, and begin countdown. I can also move each current BONUS into score and value stays constant.
I need help with the following –

  1. – I need to maintain the proper “SCORE” value, by adding each “moveState(x)” “BONUS” to the “SCORE” .
    Since the display is separated into individual digits, I believe I need a subroutine that can add the Hundreds, Tens and Ones properly, or (maybe binary or bytes) which I do not understand how to do.
    Any assistance or suggestions will be welcome, but if possible,please keep it easy to understand, Since I am not proficient in coding.
    Thanks,

countdown_timer_brainy_me5_REV6.ino (18.2 KB)

A couple of suggestions:

  1. Format your code using the IDE autoformat
  2. I would recommend using arrays instead of individual variables. It would make you code much cleaner and reduce the size of your code greatly.

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