I'm new to programming and Arduino, but struggling along.
I'm attempting to fire a relay, or a bank of relays, for a set time period, after a button is pushed.
So.
power up Arduino...
Nothing happens.
Push button for 1/2 second,
relays for for pre-determined time,
then go back to nothing until button is pressed again.
What is happening, is I power up the Arduino, my relays power up, and stay powered up, until I hold the button. ONce I hold the button, it runs my program, and from then on it works as I intend, until I power down again.
Delays are about the worst possible approach you can take, because the computer can do nothing else while delaying.
Study the "BlinkWithoutDelay" example that comes with the Arduino development software to see how to use the system timer (the millis() function) to accomplish what you want.
I only need the computer to do one thing though lol.
The milli function and tutorial in the link are above my head at the moment.
I'm attempting to accomplish what I want, which is do nothing until the button is pushed, then run the sketch, with an IF statement, but my code is not compiling.
This is a photo of how I have everything wired, except the resistor the trigger wire goes to is actually a 5 pin relay, I just couldn't find a phto of that to use.