Guidance requested for Nixie counter - Beginner

Hello all, I was wondering if anybody could help me/ point me in the right direction with a project I am working on. I will start by explaining what I would like to accomplish.
I would like to create a counter of sorts to display from "00" to "99" in 1 second on two nixie tubes while a button is held down. The sticking point for me so far is that when the button is released I want the nixies to immediately default to "00" regardless of what digit it is currently on, and as long as the button is held to remain at "99". I managed to wire my two nixies up with two K155ID1 hexadecimal decoders. so each tube uses 4 digital out pins to control the numbers. And using the much hated "delay" function I cobbled together some code that roughly does what I want it to do, except the counter continues until it reaches "99" whether I release the button or not.
I am a beginner in regards to arduino and electronics in general. I'm not going to post my code as I believe I will have to start from scratch. I have done some searches to try and find a solution to this , but so far have not found anything to help me solve this problem.
Really what I'm looking for is a confirmation that this is possible with arduino, and suggestions as to which functions I should educate myself in order to achieve this. Thank you so much for reading this, and helping if possible, Thanks!

P.s. This is what I have so far. nixie counter project - YouTube

Have a look at blink without delay example, also the “while” instruction ( google “ Arduino while”).

So you can write something along the line of while the digital input is active increment the counter .

Thanks,I will look into it.

Sounds like you did something wrong in your sketch. Without seeing your sketch it will be hard to guess what mistake you made. My guess would be that you aren't checking the state of the button in your loop from 0 to 99.

Using the stateChangeDetection example as a starting point, I think this does more or less what you need…

const uint8_t  buttonPin = 8;

int buttonState = HIGH;         // current state of the button
int lastButtonState = HIGH;     // previous state of the button

void setup()
{
  pinMode(buttonPin, INPUT_PULLUP );
  Serial.begin( 9600 );
}

void loop()
{
  static uint32_t timer = millis();
  const uint16_t interval = 10;
  static uint8_t counter = 0;
  static bool runCounter = false;
  if( runCounter && millis() - timer >= interval )
  {  // this block of code executes repeatedly if the button is held down
    
    if( counter < 10 ) Serial.print( 0 );
    Serial.println( counter );
    counter++;

    if( counter == 100 ) runCounter = false;
    timer = millis();
  }
  buttonState = digitalRead( buttonPin );
  if ( buttonState != lastButtonState )
  {
    if ( buttonState == LOW )
    {
      runCounter = true; // enable counter when button press is detected
    }
    else
    {
      // button released - disable / reset counter and print zeros
      counter = 0;
      runCounter = false;
      Serial.println("00");
    }
    // Delay a little bit to avoid bouncing
    delay(50);
  }
  lastButtonState = buttonState;

}

You’ll need to shoehorn your nixie code in where I’ve just printed the numbers.

This is very helpful, thank you so much!

Hi,
Welcome to the forum.

Please read the post at the start of any forum , entitled "How to use this Forum".
OR
http://forum.arduino.cc/index.php/topic,148850.0.html.
Then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

Thanks.. Tom... :slight_smile: