Arduino SMART HOUSE (Code)
Tutorial#include [LiquidCrystal.h]
#include [Keypad.h]
const int blueled = 13;
const int touchpin =0;
const int motionpin= A0;
const int flamepin=A1;
const int ldrpin=A2;
const int buzpin=12;
char password[4] ="1245";
int keyposition = 0;
const byte rows = 4;
const byte cols = 4;
char keyMap [rows] [cols] = {
{'1', '2', '3', 'A'},
{'4', '5', '6', 'B'},
{'7', '8', '9', 'C'},
{'*', '0', '#', 'D'}
};
byte rowPins [rows] = {1, 2, 3, 4}; //pins of the keypad
byte colPins [cols] = {5, 6, 7, 8};
Keypad kibrdkeys = Keypad( makeKeymap(keyMap), rowPins, colPins, rows, cols);
const int rs = 9, en = 10, d4 = 11, d5 =A3 , d6 = A4, d7 = A5;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
void setup(){
lcd.begin(16, 2);
pinMode(blueled, OUTPUT);
pinMode(motionpin,INPUT);
pinMode(touchpin,INPUT);
pinMode(ldrpin,INPUT);
pinMode(buzpin,OUTPUT);
pinMode(flamepin,INPUT);
}
void loop(){
int touchsens=digitalRead(touchpin);
int motionsens=analogRead(motionpin);
char enteredKey = kibrdkeys.getKey();
lcd.setCursor(0, 0);
lcd.print(" Welcome");
lcd.setCursor(0, 1);
lcd.print(" PEPS");
if (touchsens==LOW) {
if (motionsens>=200) {
lcd.clear();
lcd.print("Enter Password");
delay(100);
if(enteredKey == '7' ||
enteredKey == 'A' ||
enteredKey == '0' ||
enteredKey == '3' ||
enteredKey == '#' ||
enteredKey == '*' ||
enteredKey =='8' ||
enteredKey== '9' ||
enteredKey== 'C' ||
enteredKey== 'D'||
enteredKey== '6' ||
enteredKey =='B' )
{
keyposition=0;
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Invalid Key");
delay(1000);
lcd.clear();
}
if(enteredKey == password [keyposition]){
keyposition++;
}
if(keyposition == 4){
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("wlcm");
delay(5000);
lcd.clear();
keyposition=0;
}
}
}
int flamesens=analogRead(flamepin);
int ldrsens=analogRead(ldrpin);
if (flamesens<=200) { digitalWrite(blueled,HIGH); tone(buzpin,100); delay(100); noTone(buzpin); digitalWrite(blueled,LOW); delay(100); } else { noTone(buzpin); digitalWrite(blueled,LOW); } if (ldrsens<=500) { lcd.clear(); lcd.print("darkness"); digitalWrite(blueled,HIGH); delay(100); digitalWrite(blueled,LOW); delay(100); lcd.clear(); } delay(100); lcd.clear(); } For a tutorial about this project please check the link.
NOTE: Please change [] this sign to <> in first two lines.
sugarboo extra long digital titanium styler
ReplyDeleteType: Tagged: sugarboo extra long - titanium-arts.com - Tagged: sugarboo trex titanium headphones extra titanium mokume gane long - titanium-arts.com - Tagged: sugarboo powerbook g4 titanium extra long.com babyliss pro nano titanium - titanium vs stainless steel Tagged: