Harti Laura
Harti Laura
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <Keypad.h>
#include <SoftwareSerial.h>
int _timeout;
String _buffer;
// Password Length
String Data;
// Password
byte data_count = 0;
char customKey;
char hexaKeys[ROWS][COLS] = {
};
// Connections to Arduino
void setup() {
lcd.init();
lcd.backlight();
pinMode(lockOutput, OUTPUT);
pinMode(buzz, OUTPUT);
//delay(7000); //delay for 7 seconds to make sure the modules get the signal
Serial.begin(9600);
_buffer.reserve(50);
Serial.println("Sistem Started...");
sim.begin(9600);
delay(1000);
void loop() {
lcd.setCursor(0, 0);
lcd.print("Enter Password:");
customKey = customKeypad.getKey();
if (customKey) {
Data += customKey;
lcd.setCursor(data_count, 1);
lcd.print(Data[data_count]);
data_count++;
if (data_count == Password_Length) {
lcd.clear();
if (Data == Master) {
// Correct Password
digitalWrite(lockOutput, HIGH);
delay(5000);
digitalWrite(lockOutput, LOW);
delay(500);
digitalWrite(buzz, HIGH);
delay(500);
digitalWrite(buzz, LOW);
delay(500);
digitalWrite(buzz, HIGH);
delay(500);
digitalWrite(buzz, LOW);
delay(500);
digitalWrite(buzz, HIGH);
delay(500);
digitalWrite(buzz, LOW);
delay(500);
delay(200);
delay(200);
delay(100);
delay(200);
_buffer = _readSerial();
else {
// Incorrect Password
lcd.print("Incorrect");
delay(1000);
delay(200);
delay(200);
String SMS = "Warning! Somebody attemted to open your parcel reciever box!";
sim.println(SMS);
delay(100);
delay(200);
_buffer = _readSerial();
digitalWrite(buzz, HIGH);
//digitalWrite(lockOutput, LOW);
delay(5000);
digitalWrite(buzz, LOW);
delay(500);
}
// Clear data and LCD display
lcd.clear();
clearData();
void clearData() {
//Reset data_count
data_count = 0;
//Reset Data
Data ="";
String _readSerial() {
_timeout = 0;
delay(13);
_timeout++;
if (sim.available()) {
return sim.readString();
}
CIRCUIT DIAGRAM
BLOCK DIAGRAM