Hi. I am a newbie in Arduino. I am fighting with this issue for quite some time. I am trying to implement a classic Arduino project: flash triggered by a sensor. I have a laser that shines on a DFRobot light sensor, when laser light is blocked (value becomes more than the threshold), Arduino sends signal that goes through an optoisolator and triggers a Canon flash. (similar to mrichardson23's project from Make magazine) . For now there is no camera. Everything works - I photographed a Coke can falling into an aquarium (without fish) - looks good! But I wanted to photograph a much faster event - a whip overcoming sound barrier. My setup does not work for fast traveling objects, even a finger quickly moved through the beam does not fire the flash. Below is my code. Please help. P.S. My threshold is just over the light level when the laser shines.
int LASER_PIN = 5; int FLASH_PIN = 4; int SENSOR_PIN = 0; int SENSOR_THRESHOLD = 430;
void setup() { pinMode(FLASH_PIN, OUTPUT); digitalWrite(FLASH_PIN, LOW); pinMode(LASER_PIN, OUTPUT); digitalWrite(LASER_PIN, HIGH); } void loop() { int sensorVal; sensorVal = analogRead(SENSOR_PIN); if (sensorVal > SENSOR_THRESHOLD) //If we sense a shadow: { digitalWrite(FLASH_PIN, HIGH); // fire flash delay(10); digitalWrite(FLASH_PIN, LOW); } }