Tying data to variables so as to not write lots of if statements


//Sensor Variables
const int sensorPin = A5;
int sensorValue = 0;

//Place variables - data placement
int place = 1;
float seconds;
float personTime;
unsigned long currentMillis = 0;
unsigned long prevMillis = millis;
unsigned long minutes = 0;
int heat = 1;

//indicators
int greenPin = 10;
int redPin = 11;
int note = 1246;

//button things
const int  buttonPin = 2;      
int buttonPushCounter = 1;   
int buttonState = 0;         
int lastButtonState = 0; 




void setup() {
  
  pinMode(buttonPin, INPUT);
  
  pinMode(greenPin, OUTPUT);
  pinMode(redPin, OUTPUT);
  digitalWrite(greenPin, LOW);
  digitalWrite(redPin, HIGH);
  
  Serial.begin(9600);
}


//beep when things are crossed
void flash(){
  digitalWrite(greenPin, HIGH);
  digitalWrite(redPin, HIGH);
  tone(6, note);
  delay(100);
  digitalWrite(greenPin, HIGH);
  digitalWrite(redPin, LOW);
  noTone(6);
}
//play the note we want
void playNote(){
  tone(6, note);
  delay(500);
  noTone(6);
}

//start the race
void startRace(){
  Serial.print("Race ");
    Serial.print(heat);
    Serial.println(" started");
    
    flash();
    heat++;
}

//stop the race
void stopRace(){
  Serial.println("Race ended");
 // flash();
}

//where the magic happens
void runTimer(){
  currentMillis = millis();
  seconds = currentMillis - prevMillis;
  float personTime = seconds/1000;
  sensorValue = analogRead(sensorPin);
  digitalWrite(greenPin, HIGH);
  digitalWrite(redPin, LOW);
  //for callibration ------------------------------------------- CALLIBRATION HERE
 // Serial.println(sensorValue);
  //delay(10);

  if(seconds < 100){
    startRace();
  }
  
 //print the time!!!
 if(sensorValue < 750){
  
  Serial.print("Place ");
    Serial.print(place);
    Serial.print(" Time: ");
    unsigned minutes = (personTime + .0005) / 60;
  personTime -= minutes * 60;
  Serial.print(minutes);
  Serial.print(':');
  if ((personTime + 0.0005) < 10)
    Serial.print('0');
  Serial.println(personTime, 3);
  flash();
place++;
  } 
   
}

//and stop the timer
void stopTimer(){
  digitalWrite(redPin, HIGH);
  digitalWrite(greenPin, LOW);
  seconds = 0;
  place = 1;
  minutes = 0;
  prevMillis = millis();
  
}


//where we actually do stuff
void loop() {
  buttonState = digitalRead(buttonPin);
  if (buttonState != lastButtonState) {
    if (buttonState == HIGH) {
      buttonPushCounter++;
    } else {
    }
   delay(50);
  }
  lastButtonState = buttonState;
  if (buttonPushCounter % 2 == 0) {
    //Serial.println("GO!");
runTimer();   
  } else {
    stopTimer();
  }
}