Skip to content

Commit 28f06a8

Browse files
committed
Added button for force open
1 parent 1f3de3d commit 28f06a8

4 files changed

Lines changed: 18 additions & 1 deletion

File tree

AVP.png

15.1 KB
Loading

LCD_Keypad_Vault/LCD_Keypad_Vault/LCD_Keypad_Vault.ino

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
#include "Buzzer.h"
1111
#include "IICLCD.h"
1212

13+
#include <Bounce2.h>
14+
#define OPEN_BUTTON 5
15+
Bounce open_button = Bounce(); // Instantiate a Bounce object
16+
1317
#include <Countimer.h>
1418
Countimer timer;
1519

@@ -139,11 +143,23 @@ void setup() {
139143

140144
timer.setCounter(0, TIMEOUT_RANGE, 0, timer.COUNT_DOWN, NULL);
141145
timer.setInterval(refreshClock, 1000);
146+
147+
open_button.attach(OPEN_BUTTON,INPUT_PULLUP); // Attach the open_button to a pin with INPUT_PULLUP mode
148+
open_button.interval(25); // Use a debounce interval of 25 milliseconds
149+
142150
}
143151

144152
// the loop function runs over and over again until power down or reset
145153
void loop() {
146154

155+
open_button.update(); // Update the Bounce instance
156+
157+
if ( open_button.fell() ) {
158+
lock_servo->Open();
159+
delay(3000);
160+
lock_servo->Close();
161+
}
162+
147163
switch (safe_process)
148164
{
149165
case S_INITIALIZE:

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* [**Keypad.h**: _Library for using matrix style keypads with the Arduino_](https://github.com/Chris--A/Keypad)
1717
* [**Servo.h**: _This library allows an Arduino board to control RC (hobby) servo motors_](https://github.com/arduino-libraries/Servo)
1818
* [**LiquidCrystal_I2C.h**: _The library allows to control I2C displays with functions extremely similar to LiquidCrystal library_](https://github.com/fdebrabander/Arduino-LiquidCrystal-I2C-library)
19-
19+
* [**Bounce2.h**: _Debouncing library for Arduino and Wiring by Thomas Ouellet Fredericks with contributions from: Eric Lowry, Jim Schimpf, Tom Harkaway, Joachim Krüger and MrGradgrind._](https://github.com/thomasfredericks/Bounce2)
2020

2121
#### `Pins`
2222

@@ -26,6 +26,7 @@
2626
* GREEN_PIN 8
2727
* RED_PIN 7
2828
* BUZZER_PIN 6
29+
* OPEN_BUTTON 5
2930

3031
//For Keypad 3x3
3132
* R1 41

frtizing/AVP.fzz

1.49 KB
Binary file not shown.

0 commit comments

Comments
 (0)