Hello,
I’m doing an access control system, I’m having a little problem with the start button.
For the implementation of the system, I put the output button between the voltage source and the electromagnetic lock (view image). The button is normally closed (NC) when pressing the button the electromagnetic lock is turned off and the door is opened (in theory). But in practice it is not so, because the lock has to be unloaded. When the user presses the button, the electromagnetic lock is not discharged in that time interval, so the door is still closed.
In order for the electromagnetic lock to fully discharge the user has to hold the exit button pressed, the problem here is that when the button is released the electromagnetic lock is energized again and as a consequence the user will not be able to leave because the door is closed.
So I’m thinking of putting the start button as the arduino’s input.
The problem of putting the output button on the arduino, is that the arduino freezes when it passes a “switch” instruction. So if at any moment a user or intruder accesses a menu and someone wants to leave the place, it can not leave because the arduino is waiting for the user or intruder to press a button on the keyboard.(Attached code) In the code, I made a interruption but it does not work when the program is in the menu. Because it is waiting for the user to press a key.
It is important that the people who are inside the place can leave at any time.
Someone to help me please?
(translate by: translate.google)
sketch_dec10a.ino (2.64 KB)