hai everybody,, i need your help, i want create program when i hold down push button the relay turn on within 2 second then relay turn off, then when i release push button and hold it again the program run again, i try so many program i created, it all fail. the matter i can do it in the void loop and void setup, cause if i put in void loop it will read repeadly and my relay can turn off, if i put in void setup the program just can run 1 time.
how i can create that program? can anybody help me with the program?
You also need to tell us a bit about what your circuit is between Arduino and relay's coil. And, if you can, details of the coil... what voltage it was made for, what current flows when that voltage is applied. Unless you have just the right relay, you can't just connect the Arduino output to the coil.
(That page also gives help with what else you need... a transistor to carry the current the coil will let flow. And to allow a different voltage on it.)
===
Oh! Also!... START by getting your Arduino to turn an LED while the button is pressed. Once THAT's working, you can (fight with the details to) connect the relay in place of the LED. Also... there are fewer ways to hurt your Arduino if you are only driving an LED.