Go Down

Topic: delay (Read 693 times) previous topic - next topic

daniellyall

can the delay in a sketch be controlled externally from the sketch

keeper63


can the delay in a sketch be controlled externally from the sketch


Do you mean something like:

Code: [Select]
delay(analogRead(pin)); // delay up to approx. 1 second based on reading from analog input

I mean - that would work, but it wouldn't be the best way for your code to be written because delay() is a blocking function; you could, though, do something similar that isn't blocking, once you understand how the "blink without delay" example sketch works:

http://arduino.cc/en/Tutorial/BlinkWithoutDelay#.UwKTNEkS0ss
I will not respond to Arduino help PM's from random forum users; if you have such a question, start a new topic thread.

daniellyall

will test code see what happens

Go Up