I have simulated my project Arduino Smart Lock in Proteus and its worked like a charm. But in real hardware its displaying locked unlocked intermittently without even asking for password. The project actually is a 3 level password based security which asks for a primary password first. If the primary password is correct then it asks for a secondary password. If both passwords are correct then a servo motor connected to pin 6 of arduino opens the door. The persons can go inside and locks the door. A switch is provided for opening the door from inside. Incase of emergency a third password is also provided by which any person outside can open the door. i have rechecked the code many times. But cant find the fault in it. Can any geek here pls help me out?
why do you have code dealing with new keys executing while there is nothing entered?
Hii.. I havent understand your question.. Can you kindly elaborate?
your loop() code looks like this:
```
customKey = customKeypad.getKey(); // Returns key that is pressed, if any. This function is non-blocking
if (customKey) // would be better to check (customKey != NO_KEY) for coherence
{
// executed only when you get a new key
}
if(customKey=='D')
{
// executed all the time if last key typed, even a year ago, was 'D'
}
if(customKey=='B')
{
// executed all the time if last key typed, even a year ago, was 'B'
}
```
also using labels and goto is not great design practice.
Hi,
Welcome to the forum.
Please read the first post in any forum entitled how to use this forum.
http://forum.arduino.cc/index.php/topic,148850.0.html then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.
Thanks.. Tom...