hey guys am new with the arduino and am having some troubles concerning tho codes for the servo motor that i want to use to unlock my door after some specific knocks. can anyone help me please...!
hey guys am new with the arduino and am having some troubles concerning tho codes for the servo motor that i want to use to unlock my door after some specific knocks. can anyone help me please...!
knock_3_doors_unlock.ino.zip |
What trouble are you having?
Tim
What trouble are you having?
Tim
i have already written all the codes it seem correct but when trying it,
its not working properly, like when i knock 3 times it doesn`t unlock door
even if it recognise the three knocks.
Can you post your code and schematic and we will have a look for you
Peter
// import the library
#include quietKnock && value < loudKnock)
{
// turn the status LED on
digitalWrite(yellowLed,HIGH);
delay(50);
digitalWrite(yellowLed,LOW);
// print out the status
Serial.print("Valid knock of the value");
serial.println(value);
// return true
return true;
}
// if the knock is not within range
else
{
// print status
Serial.print("Bad Knock value");
Serial.println(value);
//return false
return false;
}
}
Part of the answer to your question will be a suggestion for HOW you get it working.
You say that it isn't recognizing your knocks OR opening the door. Are you sure?
For a start, put your "open the door" code into a routine, if you haven't done so already.
Tweak your code so that it winks an LED when it recognizes the knock code. Get that much working. Then replace the "wink LED" code with a call of a routine to open the door.
And, either first or second, add a button to the Arduino, and program it so that pressing the button calls the "open the door" code. (Make it call a simple "Wink the LED" routine first, just to be sure the Arduino IS seeing you press the button.)
Divide and conquer!
===
While writing...
Have you considered the old engineering adage: "The solution to the problem may be a different question"...
The servo actuated lock may be a hassle on mechanical grounds, even if you get the programming working... although I concede that there will be circumstances where it will be "the answer". Alternatively, electro-mechanical strikeplates are great if the door is secured with a "Yale" type lock: I.e., you just pull it closed to lock it. (And you have the authority and the carpentry skills!) For one thing, it leaves the mechanical lock unchanged, so that you can, sigh, use the old fashioned key when your alternative isn't working.
More on electro-mechanical strikeplates at..
Electromechanical strike plates (electronic access control)- ec1ems
(And an Arduino/ RFID reader based access control system) at...
RFID reader from Sparkfun or Iteadstudio connected to Arduino- art3rfid1
(And it does work: It is how I have accessed two different properties for several years now.)