const int blitzPin = 13; // the output pin to the flash const int resPin = 2; // the input of the lightbarrier int sensorValue = 0; // set the sensor-value to zero int verzoegerung = 100; // delay between lightbarrier and flash void setup() { pinMode(blitzPin, OUTPUT); // setup output pin for flash pinMode(resPin, INPUT); // setup input pin for lightbarrier } void loop() { sensorValue = digitalRead(resPin); // read the value of the barrier if (sensorValue){ // if lightbarrier is high delay(verzoegerung); // wait for a moment digitalWrite(blitzPin, HIGH); // trigger the flash delay(200); // wait again digitalWrite(blitzPin, LOW); // release the flash } }