Date: 13/10/2014 (Monday)
Title: Learn to Create Program
Before I create Actual program for my Project . I learn the basic of Program that will i used in my project . Below the basic program that i use such as :
1) Basic LCD Program
LiquidCrystal lcd(5, 0, 4, 3, 2, 1);
void setup()
{
lcd.begin(20,4);
lcd.clear();
}
void loop()
{
lcd.print("Enter Pin");
delay(3000);
lcd.setCursor(0,1);
lcd.print("12345");
delay(3000);
lcd.setCursor(0,2);
lcd.print("Correct");
delay(3000);
lcd.setCursor(0,3);
lcd.print("Alarm Activate");
delay(1000);
lcd.display();
lcd.clear();
}
The Screen Shoot :
2) Keypad 4 X 4 combine LCD
#include <Wire.h>
#include <LiquidCrystal.h>
#include <Keypad.h>
const byte rows = 4 ;
const byte cols = 4;
char keys[rows][cols] =
{
{'1','2','3','A'},
{'4','5','6','B'},
{'7','8','9','C'},
{'*','0','#','D'}
};
byte rowPins[rows] ={13,12,11,10};
byte colPins[cols] ={9,8,7,6};
Keypad keypad =Keypad(makeKeymap(keys),rowPins,colPins,rows,cols);
LiquidCrystal lcd( 5, 0, 4, 3, 2, 1 );
void setup()
{
lcd.setCursor(3,0);
lcd.print("You Pressed");
}
void loop()
{
char key = keypad.getKey();
if(int(key) !=0)
{
lcd.setCursor(16,0);
lcd.print(key);
}
}
The Print Screen :