hello
I am trying to remote fire a camera shutter using an arduino pro mini.
been following this video Arduino Gestures with MPU6050 Accelerometer - 2016-12-22 - YouTube
and accompanying code
The handleLights() function is called on detecting a gesture using an MPU6050 and this is working fine, setting the pin to HIGH. I can't seem to put the delay and digitalWrite(SHUTTER_PIN, LOW); in the right place and the pin stays high with the code hanging up. when I comment out the delay and set to LOW, it works fine again but stays HIGH.
can anyone help?
thanks
Andre
void handleLights(){
if(glowing){
DEBUG_PRINTLN("GLOWING!");
if(glowEnd == -1)
glowEnd = millis() + glowDuration;
if(millis() > glowEnd)
glowing = false;
// run glow function here
blinkState = !blinkState;
}
if(!glowing){
// do some variable cleanup
glowEnd = -1;
blinkState = false;
}
digitalWrite(LED_PIN, blinkState);
digitalWrite(SHUTTER_PIN, HIGH);
delay(500);
digitalWrite(SHUTTER_PIN, LOW);
}