 FSM stateMachine = FSM(startupState);
 
 void setup() {
+  pinMode(TRIGGER_BUTTON, INPUT_PULLUP);
+  pinMode(ARMING_SWITCH, INPUT);
+  pinMode(ARMED_LED, OUTPUT);
+  pinMode(FIRING_LED, OUTPUT);
+  
+  attachInterrupt(1,fireEvent,HIGH);
+
   startLog();
+}
+
+void fireEvent() {
+  if ((millis() - lastDebounceTime) > debounceDelay) {
+    if (stateMachine.isInState(armedState)) {
+      stateMachine.transitionTo(firingState);
+    }
+    lastDebounceTime = millis();
+  }
 }
 
 void loop() {

const byte ARMED_LED = 4;
const byte FIRING_LED = 5;

// FSM states
State startupState = State(enterStartupState,updateStartupState,leaveStartupState);
State armedState = State(enterArmedState,updateArmedState,leaveArmedState);
State firingState = State(enterFiringState,updateFiringState,leaveFiringState);



// FSM state callback methods

// -------------- Startup State ---------------
void enterStartupState() {
  note("starting up");
  startTimer(timerStartupState);
}
void updateStartupState() {
  if(isTimerExpired(timerStartupState, 5000)) {
    stateMachine.transitionTo(readyState);
  }
}
void leaveStartupState() {
  note("startup complete");
  clearTimer(timerStartupState);
}

// -------------- Ready State ---------------
void enterReadyState() {}
void updateReadyState() {}
void leaveReadyState() {}

// -------------- Armed State ---------------
void enterArmedState() {
  note("armed");
}
void updateArmedState() {}
void leaveArmedState() {}

// -------------- Firing State ---------------
void enterFiringState () {
  note("firing!");
  startTimer(timerStartupState);

}
void updateFiringState() {
  if(isTimerExpired(timerFiringState, 1000)) {
    stateMachine.transitionTo(armedState);
  }
}
void leaveFiringState() {
  note("fired!");
  clearTimer(timerFiringState);
}

// Timing helpers
void startTimer(long &timer) {
