Hello everyone,i need help please, very new to arduino code, i have a chessboard with a hall sensor hidden under it, The arduino send signal to the relay to unlock an electronic lock. But the problem i have is, the lock unlocks but the power stay on while the magnet is on the chessboard, is there a way to program the arduino to stop the power to the relay after 1 or 2 seconds?
Yes
Good day Jackson, How? Please im losing my mind here
By modifying the code you did not post, whilst ensuring the circuit you built but did not share either is OK.
In a nutshell, do yourself a favour and please read How to get the best out of this forum and modify your post accordingly (including code tags and necessary documentation for your ask).
See the "StateChangeDetection" example under "File -> Examples -> 02.Digital". That will show you how to do something when a button changes. Then, after you turn on the rely you can put in a delay() and then turn off the relay. The StateChangeDetection will keep the relay from triggering again until the magnet has been removed and returned.