![]() (Debounce timer.)Ĭonst int lockTurnTime = 5000 // milliseconds that we run the motor to get it to go a half turn.Ĭonst int maximumKnocks = 20 // Maximum number of knocks to listen for.Ĭonst int knockComplete = 1111 // Longest time to wait for a knock before we assume that it's finished. Could be made vars and hoooked to potentiometers for soft configuration, etc.Ĭonst int threshold = 7 // Minimum signal from the piezo to register as a knockĬonst int rejectValue = 25 // If an individual knock is off by this percentage of a knock we don't unlock.Ĭonst int averageRejectValue = 15 // If the average timing of the knocks is off by this percent we don't unlock.Ĭonst int knockFadeTime = 200 // milliseconds we allow a knock to fade before we listen for another one. On Leonardo/M0/etc, others with hardware serial, use hardware serial!Ĭonst int knockSensor = 0 // Piezo sensor on pin 0.Ĭonst int programSwitch = 7 // If this is high we program a new code.Ĭonst int lockMotor = 8 // Gear motor used to turn the lock. Set up the serial port to use softwareserial. pin #3 is OUT from arduino (WHITE wire) For UNO and others without hardware serial, we must use software serial. ![]() ![]() Written by Limor Fried/Ladyada for Adafruit Industries.īSD license, all text above must be included in any redistribution Please support Adafruit and open-source hardware by purchasing These displays use TTL Serial to communicate, 2 pins are required toĪdafruit invests time and resources providing this open source code, This is an example sketch for our optical Fingerprint sensorĭesigned specifically to work with the Adafruit BMP085 Breakout There are 2 LEDs which work like indicators and blinks as you tap the secre knockīut sometimes while i tap i notice that the led doesn't blink immediately and "missing a knock or some knocks i have to make few knocks until it starts blinking and it inputs a "wrong knock" (delay?)īoard Arduino uno /*************************************************** ![]() Now the fingerprint sensor works good ,but the piezo sensor is having issues Arduino measures the duration of pulse to calculate distance. ECHO pin: this pin sends a signal (pulse) to Arduino. Made a project to open a lock with a sensor and for fun added a piezo sensor which works as a secret knock detector so there are two ways which activate the lock. The ultrasonic sensor HC-SR04 includes four pins: VCC pin: needs to be connected to VCC (5V) GND pin: needs to be connected to GND (0V) TRIG pin: this pin receives the control signal (pulse) from Arduino. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |