Problem with my flash trigger

I had a previous topic of 'Problem with arduino and optoisolators', we got that to work, and the flash trigger worked great...for a few hours. What is supposed to happen is : Ready light on, press a button, and ready light goes out, opens the shutter, waits for an input from the sound sensor, then fires the flash when it hears it, then closes the shutter. Well it worked for a little while, then after a push of the button, the ready light would attempt to go out, but the flash would trip and the cycle would end. The shutter release 'flashes' at the same time. I have stripped the board, and re-did a new pc board, careful with the solder, and wireing, but it does exactly the same thing. I put a different Arduino micro on, and still is messed up. This project is the same as Matt Richardsons, and I used his code. (I do not have the work light part of the project though, but I left the code in.
Here is the code I use:
Is there something I am missing, in this explanation, I am 99% sure the build was done correctly.

/* Audio camera trigger by Matt Richardson
This is a basic sound-detecting camera & flash trigger for Arduino.
Use a piezo element for sensor(see http://www.arduino.cc/en/Tutorial/KnockSensor)
Use opto isolators (aka optocouplers) for the flash and camera triggers
Camera must be in BULB mode for shutter release to work
*/

#define BUTTON_PIN 5
#define CAM_TRIGGER_PIN 11
#define FLASH_TRIGGER_PIN 12
#define SENSOR_PIN 0
#define LED_PIN 10
#define STANDBY 0
#define ACTIVE 1
#define WORKLIGHT_RELAY 9
#define SENSOR_THRESHOLD 0

int mode = STANDBY;

// For best results, set flashDelayMS according to what type
// of shot you're doing. 0 seems best for balloon burst while
// 10 seems best for shattering glass. YMMV.
long flashDelayMS = 10;

void setup() {
pinMode(BUTTON_PIN, INPUT);
pinMode(CAM_TRIGGER_PIN, OUTPUT);
pinMode(FLASH_TRIGGER_PIN, OUTPUT);
pinMode(LED_PIN, OUTPUT);
pinMode(WORKLIGHT_RELAY, OUTPUT);
digitalWrite(LED_PIN, HIGH);
digitalWrite(WORKLIGHT_RELAY, HIGH); //turn the lights on
}

void loop() {
if (digitalRead(BUTTON_PIN) == HIGH)
{
mode = ACTIVE;
digitalWrite(WORKLIGHT_RELAY, LOW); // turn the lights off
delay(2000); // to give time for light to go down and settle after button push
digitalWrite(LED_PIN, LOW); // show we're ready
digitalWrite(CAM_TRIGGER_PIN, HIGH); // open the camera shutter
}
if ((mode == ACTIVE) && (analogRead(SENSOR_PIN) > SENSOR_THRESHOLD)) //
{ //If we're in ACTIVE mode and we sense a pop:
delay(flashDelayMS);
digitalWrite(FLASH_TRIGGER_PIN, HIGH); // fire flash
delay(50);
digitalWrite(FLASH_TRIGGER_PIN, LOW);
digitalWrite(CAM_TRIGGER_PIN, LOW); // close camera shutter
mode = STANDBY;
digitalWrite(LED_PIN, HIGH);
digitalWrite(WORKLIGHT_RELAY, HIGH); // turn lights back on
}
}

I think what you should do is isolate the code that detects the shutter from the code that triggers flash.

That would also allow you to test isolate any hardware problems. i.e. Just flash an LED when the piezo is triggered. Then flash the strobe under program control with no piezo signal.

That's how you troubeshoot... Test the individual hardware & software sections to zoom-in on the problem.

Do you have a link to the schematic? Do you have a multimeter so that you can check voltages & connections?

Problem solved...I was using the wrong friggin battery. I was using a 9 volt battery to power the system, after I got it into a project box. It reacted as if the sensor was faulty, and immediately triggered the flash. When the activation button was pressed.
I put in a 6 volt (4AA's) battery pack, and it works great. I tore the system apart, and rebuilt it many times, and double checked the code etc etc etc.
I thought that the Arduino Micro would be good from 5v to 12v. I guess I was mistaken.
I hope this may help someone else that runs into a similar problem.
Steve