How to have a Triggered Pulse

Hi, I am new to Arduino and I am looking for a simple way to have a pulse triggered by an input, without using the delay command.

Any help will be greatly appreciated.



Turn the pin on when you want it on. Periodically, check to see if the pin has been on long enough. If so, turn it off.

Check for blink without delay in the Arduino Playground. . that will surely help a lot.

Here is the link :


Taz ..

You may wish to substitute "micros" wherever it says "millis"

For the trigger, use an external interrupt. Have the interrupt set the output pin high and record the current time (t0). In the main loop, write an IF statement that compares the current time (t1) against the time the pin was set HIGH (t0). Once they exceed some threshold (t1-t0 > 1ms) then write the pin LOW.

This example should help explain it:

EDIT: beat me to it.