Help with displaying on led display

HI , I am trying to get my display to look a bit more pinball style. I have it all working but wanted some advice. When I send the score to the display it sends Ok and displays. This is where my issue is I want the display to roll to the score e.g count up to it really quickly so it more rolls.

I was thinking of adding a function that I call when lets say a 1000 needs adding

Below is a section of my code

//start read pins//
//this reads pin12 and does something
int switchpin12 = 12;
Serial.begin(57600);

pinMode(switchpin12, INPUT_PULLUP); // sets the digital pin 12 as input
int val12 = 0;//value you zero
val12 = digitalRead(switchpin12);
delay (200);

//if pin 12 connects then do something//

if (val12 <1){
wTrig.trackGain(10, 30);
wTrig.trackPlayPoly(10);//play track 10

delay (100);
score=score + 10000 * multi; //add score plue multiplier

//print on the led module//
module.setDisplayToDecNumber(score, 0, false); // add score for pin 12 to display

Below is a section of my code

Below is a section of my answer
is post ALL of your

You've made enough post to this Forum to know to use code tags when posting. If not, read Nick Gammon's two posts at the top of this Forum. One of his suggestions is to post all of your code.

sorry for the mistake I made when posting code;

I have worked out how to use and call the function. I have am not however having much luck with the rolling of the score. it kind of works. the variable score is used to hold the full score , I want to be able to add a certan number to this by rolling the score. When I connect pin 12 the score should go up by 1000

//define addscorefuntion in prep fpr rolling display... it justs adds the score from score

void addscoreled() 
{

  
  for (int score1 = 0; score1 < 10001; score1 = score1 + 50)  {//////roll the score
     module.setDisplayToDecNumber(score1+score, 0, false);   
  }
  
    
 
}

I have no idea of what you’re actually trying to do, but at least this might be a starting point. It’s up to you to correct things according to what you want to do.

#define SWITCHPIN  12
long score;

void setup() {

  Serial.begin(57600);

  pinMode(SWITCHPIN, INPUT_PULLUP);      // sets the digital pin 12 as input
  score = 0L;
}

void loop() {
  int switchVal;
  switchVal = digitalRead(SWITCHPIN);
  delay (200);

  if (switchVal < 1) {
    wTrig.trackGain(10, 30);
    wTrig.trackPlayPoly(10);//play track 10

    delay (100);
    score += 10000L * multi; //add score plus multiplier WHAT IS multi's VALUE AND TYPE?
    //print on the led module//
    addscoreled();  // Have no idea if this is what you want.
    
    // Where is this from??
    module.setDisplayToDecNumber(score, 0, false); // add score for pin 12 to display
  }
}


void addscoreled() 
{

  for (int score1 = 0; score1 < 10001; score1 = score1 + 50)  {//////roll the score
     module.setDisplayToDecNumber(score1+score, 0, false);   
  }
}

I notice that you use a define on switchpin what is the difference to the way I did it??

Many thanks

Rick

I have attached all the code

pinscoreusing_pins_v3.ino (10.9 KB)

int switchpin12 = 12;

only needs a byte, and is stored in SRAM, of which there is a limited amount.

byte switchpin12 = 12;

There is much more flash:

#define SWITCHPIN 12
const byte switchpin12 = 12;

Compiler does things to embed the number 12 into the code so SRAM is not used, freeing it for other stuff.

ah I see. Will bear that in mind. This i my first project and I sometimes wonder if I have been a bit to rushed. But I keep plodding on.