Hi, I need help creating a password system for a fake S&D bomb.
FYI I am using an Elegoo Membrane Switch for the keypad.
Here is my current code:
#include <LiquidCrystal.h>
#include <Keypad.h>
LiquidCrystal lcd(7, 8, 9, 10, 11, 12);
int a = 60;
const int beep = 2;
const byte ROWS = 4;
const byte COLS = 4;
char hexaKeys[ROWS][COLS] = {
{'1','2','3','A'},
{'4','5','6','B'},
{'7','8','9','C'},
{'*','0','#','D'}
};
byte rowPins[ROWS] = {53, 51, 49, 47};
byte colPins[COLS] = {43, 41, 39, 37};
Keypad customKeypad = Keypad( makeKeymap(hexaKeys), rowPins, colPins, ROWS, COLS);
void setup() {
pinMode(beep,INPUT);
lcd.begin(16, 2);}
void loop() {
if( a < 11) {lcd.clear(); }
if( a < 1 ) {; lcd.setCursor(0, 0); lcd.print("Boom");
digitalWrite(beep, HIGH);
delay(1000);
digitalWrite(beep, LOW);
delay(9999999999999999999000);} else{ lcd.setCursor(0, 0);
a = a - 1;
lcd.print(a);
delay(1000);
}
}
To be clear I need the code to start and stop the countdown.