My current function is supposed to play a sound effect, then after the sound effect is done (14 seconds), perform the next action (digitalWrite(CONTROLLINO_R1, LOW)).
if (digitalRead(CONTROLLINO_A8) == HIGH && !skeleLatch) {
skeleLatch = 1;
wTrig.trackPlayPoly(2);
unsigned long currentMillis = millis();
if((currentMillis-previousMillis) >= 14000) {
digitalWrite(CONTROLLINO_R1, LOW);
previousMillis = millis();
}
}
As it is, it performs both at the same time. I do not know how to correctly implement the delay so that it waits.
Any help would be appreciated. Thank you.
delay()? – jfpoilpret Jan 28 '17 at 17:00millis(). Using that you can tell whether it's been 14 seconds since a particular event. Does that give enough of a clue? – Mark Smith Jan 28 '17 at 18:46previousMillis(apart from after the decision in the code you posted)? – Nick Gammon Jan 29 '17 at 02:10