Skip to content

Instantly share code, notes, and snippets.

@ThaiEasyElec
Last active July 23, 2019 10:35
Show Gist options
  • Save ThaiEasyElec/cd7c99f99c45fb9a04d8d59300f7dcf9 to your computer and use it in GitHub Desktop.
Save ThaiEasyElec/cd7c99f99c45fb9a04d8d59300f7dcf9 to your computer and use it in GitHub Desktop.
Home Alarm Systems
#include <Password.h>
#include <Keypad.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
Password password = Password( "1234" ); // Set the Password
// Set the LCD address to 0x27 for a 20 chars and 4 line display
LiquidCrystal_I2C lcd(0x27, 20, 4);
const byte ROWS = 4; // Four rows
const byte COLS = 4; // columns
const int status_lock = A0; // LED Status Pin
const int status_unlock = A1; // LED Status Pin
const int led_bed = 11; // Home Light2 Pin
const int led_bath = 12; // Home Light1 Pin
int pir = A2; // PIR Sensor Pin
int flame = A3; // Flame Sensor Pin
int Buzzer = 10; // Buzzer Module Pin
int alarmValue = 0;
int fl = 0, state = 0, state1 = 0, state2 = 0, Alarm_fl = 0; // Flag
int dir = 8, dir1 = 0;
String test = " ";
// Define the Keymap
char keys[ROWS][COLS] = {
{'1','2','3','A'},
{'4','5','6','B'},
{'7','8','9','C'},
{'*','0','#','D'}
};
byte rowPins[ROWS] = { 2,3,4,5, };// Connect keypad ROW0, ROW1, ROW2 and
// ROW3 to these Arduino pins.
byte colPins[COLS] = { 6,7,8,9 };// Connect keypad COL0, COL1, COL2 and
// COL3 to these Arduino pins.
// Create the Keypad
Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment