Pages: [1]   Go Down
Author Topic: Project 12 (Knock Lock)  (Read 4308 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi.

I think there is a problem in the code for project 12 (or the example only works the first time for me).

I lock the box pressing the switch and unlock it knocking 3 times. But when I try lo lock it again pressing the switch, it gets unlocked without waiting for the the knocks. In the communication window, I can see:

the box is unlocked!
the box is locked!
the box is unlocked!
the box is locked!
the box is unlocked!

Upon the variable numberOfKnocks is greater than 3, the code never enters line 39 again, and always satisfies line 46 and, consecuently, it gets unlocked automatically.

If I insert in line number 53 numberOfKnocks=0; (when it gets unlocked), then it works for me.

Anyone can verify it?

Thanks.
Logged

UK
Offline Offline
Jr. Member
**
Karma: 1
Posts: 62
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I have the same
Logged

Photography nut trying to make the flux capacitor of macro pho

Varese
Offline Offline
Full Member
***
Karma: 2
Posts: 206
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello everyone, I just realized this project, but the first time it works correctly, but after knocking on it with pressing the button piezo continues unlock. I tried to add a delay () but I get the same problem.
Someone was able to find the solution?
Logged

Arduino UNO starter kit.

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi!

Here is how i fixed it:

http://forum.arduino.cc/index.php?topic=175831.msg1383787#msg1383787
Logged

Pages: [1]   Go Up
Jump to: