Controller for quad-barrel Coaxpiston-cannon

Having trouble getting this program to work…

Nothing happens when i push the fire button ect.

What am i missing in the code???

Edit: Sorry for missing out the code tags

#define relay_A 6 
#define relay_B 7
#define relay_C 8
#define relay_D 9 
#define switchButton 10 // common 5v, Change from fire one tube, to fireing all of them
#define resetButton 11 //common 5v, reset button
#define fireButton 12 //common 5v, fire button 
#define FIRE_DELAY 1000// Delay on how long the relay is HIGH 100 - 1200 aprox
boolean haveFired[] = {0, 0, 0, 0};
int valves[] = {relay_A, relay_B, relay_C, relay_D};
int fireButtonValue = 0;
boolean hasFired = false;
void setup() {
  Serial.begin(9600);
  
  // ventiler
  pinMode(relay_A, OUTPUT);
  pinMode(relay_B, OUTPUT);
  pinMode(relay_C, OUTPUT);
  pinMode(relay_D, OUTPUT);
  
  //kontakter 
  pinMode(switchButton, INPUT); 
  pinMode(resetButton, INPUT);
  pinMode(fireButton, INPUT);
  
  digitalWrite(relay_A, LOW);
  digitalWrite(relay_B, LOW);
  digitalWrite(relay_C, LOW);
  digitalWrite(relay_D, LOW);
}
void loop() {  //reset bottom, til at anullere alle tidligere kommandoer. 
  if (digitalRead(resetButton) == HIGH){
    reset();
    delay(1000);
    return;
  }
  
  if (digitalRead(fireButton) == HIGH){
    fireButtonValue++;  
    Serial.println("Firevalue: " + String(fireButtonValue) + ", hasFired: " + String(hasFired));
  } else {
    fireButtonValue = 0;
  }
  if(fireButtonValue > 5 && hasFired == false){
    fireCanon();
  }
  delay(25);
}
/**
  * Fire the canon
  * The method will fire the whole canon at once if the switch is set to fire all.
  * Otherwise only a single thing will be fired. 
  */
void fireCanon(){
  if (digitalRead(switchButton) == HIGH){//fire all
    hasFired = true;
    fireAll();
  } else { //fire one by one
    fireOneValve();
  }
}
/**
  * Method to be called when a single valve should be fired.
  * Will fire the next valve which haven't yet been fired.
  */
void fireOneValve(){
  for(int i = 0; i < sizeof(haveFired); i++){
    if(haveFired[i] == 0){
      Serial.println("I'm now going to fire: " + String(i));
      haveFired[i] = 1;
      fireValve(valves[i]);
      return;
    }
  }
  hasFired = true;
}
/**
  * Fire a single valve
  */
void fireValve(int valve){
  digitalWrite(valve, HIGH);
  delay(FIRE_DELAY);
  digitalWrite(valve, LOW);
}
/**
  * Fire all four valves
  */
void fireAll(){
  for(int i = 0; i < sizeof(valves); i++){
    digitalWrite(valves[i], HIGH);
  }
  delay(FIRE_DELAY);
  for(int i = 0; i < sizeof(valves); i++){
    digitalWrite(valves[i], LOW);
  }
}
/**
  * Reset the canon
  */
void reset(){
  hasFired = false;
  for(int i = 0; i < sizeof(haveFired); i++){
    haveFired[i] = 0;
  }
  digitalWrite(relay_A, LOW);
  digitalWrite(relay_B, LOW);
  digitalWrite(relay_C, LOW);
  digitalWrite(relay_D, LOW);
  
}

Moderator edit: you were missing code tags, which is why half your post was in italics

Luftkanon.ino (2.61 KB)

Hi, Explain what it is supposed to do and also a circuit diagram of how you have connected everything will be helpfull. Have you got the fire button connected with pullup or pulldown resistors. Tom.... :)