relay activation

Hi all, firstly, im glad to be part of the site

So here is my question,

if i am trying to close a relay when i recieve a digital pulse but keep it closed if i recieve the pulse again <= 1 second how would i go about that???


fast and dirty do a delay (1000); after you close it, just remember your arduino will pause during that 1000ms (1sec)

Thanks, will give it a go!!!

Hey it worked, great , thanks


fast and dirty do a delay (1000);

Even better, of course, is to use millis() to record when you turned the relay on, and ignore any requests to turn the relay on again unless the time between the new request and the old (successful) request is greater than the threshold. Look at the blink without delay example.

For why, suppose that the time was 1 hour, instead of 1 second, and the Arduino was displaying the time, too.

Using millis(), the Arduino would continue to display the time. Using delay() it would not.

OK ill try that aswell, seems a bit more refined, but to be honest, the timing is fine at the mo and its giving the results,though getting the feeling that could be problems later on,