Need help with setting up an action to cancel a timer.

Hello everyone! I am working on a reaction time game, with buttons and tasers.

Currently struggeling with coding the part where once a pin recieves power, it will cancel the timer.

if (digitalRead(2) == HIGH){ // Pin 2 is chosen to send power to button
if (currentMillis - previousMillis >= interval) {

}

This is the part where, once pin 2 is outputting a signal, a timer will start. I just need help with making a line where when pin 6 recieves the signal, the timer has to stop.

Thanks in advance!

Please post a complete program (use code tags when you do) so that the requirement can be seen in context

What have you tried ?

AbsoluteJerry:
Hello everyone! I am working on a reaction time game, with buttons and tasers.

What could possibly go wrong?

If only we knew what was attached to pin 1.
And pin 0, 2, …
And what sdsda means.

Edit: and now it’s gone…

unsigned long previousMillis = 0;
const long interval = 500;

randomSeed(analogRead(A0))

void setup()
{
pinMode(0, OUTPUT); // The pin that is outputting the "on" signal
pinMode(2, OUTPUT); // 2-5 are the outputting the power to the buttons
pinMode(3, OUTPUT);
pinMode(4, OUTPUT);
pinMode(5, OUTPUT);
pinMode(6, INPUT); // 6-9 are inputting the power from pressed buttons
pinMode(7, INPUT);
pinMode(8, INPUT);
pinMode(9, INPUT);
pinMode(1, INPUT); // The pin that recieves the "on" signal

digitalWrite(0, HIGH);
if (digitalRead(1, HIGH)){ // Once the "start" button is pressed, the loop starts
void loop(){
int xyz = random(2, 6); // Randomly chooses the buttons
unsigned long currentMillis = millis();
digitalWrite(xyz, HIGH) // Chooses which button to begin with
if (digitalRead(2) == HIGH){
if (currentMillis - previousMillis >= interval) { // The timer, 500 ms

}
else if (digitalRead(3) == HIGH){
sdsda
}
else if (digitalRead(4) == HIGH){
sdsda
}
else if (digitalRead(5) == HIGH){
sdsda
}

}
}
}

Here is my code so far, had to comment just in case. Also the sdsda is just placeholder until I figured out the timer thing.

Edit your post and put your code inside code tags like [code]your code here[/code]

randomSeed(analogRead(A0)) is missing the ; at the end, btw.

You’re going to find serial debugging extremely difficult - don’t use pins zero or one.

And give the pins sensible names .

(deleted)

…and make sure setup and loop are separate functions.