i'm semi-new to arduino still and what I want to do seems pretty simple but I have not been able to do it yet.
All I want to do is:
have one LED (and another pin) go to HIGH for .5sec, LOW for .5sec (or whatever times I choose)
have another LED come on when a button is depressed.
The problem i'm having is that the periodic LED takes 1 or two seconds to loop through and I cannot trigger the other LED while waiting for the first one to cycle through.
I want to do this wirelessly but that shouldnt be a problem.
thanks in advance
The general solution is not to use the delay function. Look at the blink without delay example: http://arduino.cc/en/Tutorial/BlinkWithoutDelay (http://arduino.cc/en/Tutorial/BlinkWithoutDelay)
Thanks, i'll give it a try.
Another approach is as follows...
Work things so that your "loop" executes 100 times per second, or so.
And have your "on for a bit" LED go on for 50 passes through the loop, if you want it on for 0.5 second. (You can do this with a variable you might call bCountDownToOff... set it to 50 when you turn the LED on, decrement it (subtract 1) each time you go through "loop", and turn LED off when bCountDownToOff reaches zero.
Thanks for the help guys. I was able to accomplish my goal using the "blink without delay example". If I have spare time I may try the countdown method but I'm wondering if the speed that the processor is able to get through the loop changes based on the task that it is working on. I will be recording the 5v output signal on two different data loggers and using it sync the two units, so it's pretty important that the signal is consistent. A few millisecs off here or there is ok but not much more.