Pages

Tuesday, 2 June 2015

2 KEYS KEYPAD

OVERVIEW


2 Keys Keypad can be connected to any microcontroller or any interfacing kit directly. KEY is a small keypad designed to data entries for microcontroller board. The board has 4-pin header for 4-wire ribbon cable. By default the switch status would be pulled up, every time you press a key the corresponding switch header changes its state to the common header in the board.


FEATURES



ARUDUINO CODE


#include <LiquidCrystal.h>
LiquidCrystallcd(12, 11, 5, 4, 3, 2);

constintsw1 = 0 ;    
constintsw2 = 1;



void setup() {

lcd.begin(16, 2);
pinMode(sw1, OUTPUT);
pinMode(sw2, OUTPUT);

}

void loop()
{
  if(sw1==HIGH)
  {
lcd.print("switch 1 is pressed");
  }

  else if(sw2==HIGH)
  {
lcd.print("switch 2 is pressed");
  }


}