IoT Project, Setting up Keypad with the password
Arudino KeyPad Program
IoT Project, Setting up Keypad with the password

This project is about configuring Keypad. Keypad has many uses in the IoT world. For example, you can use it as the password entry for locking and unlocking something. You can read an article here which is about the use of Keypad with Servo Motor. For this project, we have also a complete and step-by-step tutorial which you can watch here.

Codes


#include <Keypad.h>

const byte ROWS = 4; //Four rows
const byte COLS = 4; //Four columns
char keys[ROWS][COLS] = {
  {'1','2','3','A'},
  {'4','5','6','B'},
  {'7','8','9','C'},
  {'S','0','H','D'}
};
byte rowPins[ROWS] = {9, 8, 7, 6}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {5, 4, 3, 2}; //connect to the column pinouts of the keypad

Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );

String v_passcode="";

void setup(){
  Serial.begin(9600);
}

void loop(){
  char key = keypad.getKey();
  
  if (key != NO_KEY){
    //Serial.println(key);
    
    v_passcode = v_passcode + key;
    
    if(key=='A')
    {
    	Serial.println("Enter Password");
        v_passcode="";
    }
    
    if(key=='D')
    {
    	Serial.println("Validate the Password");
      	//Serial.println(v_passcode);
      	
      	if (v_passcode=="589D")
        {
          Serial.println("Access Granted");
        }
      	else
        {
        	Serial.println("Access Denied");
        }      
    }        
  }
}

You can follow our YouTube Tutorial regarding this project, and use the above code based on your own needs. You can also access the actual TinkerCad Project by clicking here.

SHARE

Share on facebook
Share on twitter
Share on whatsapp
Share on linkedin
Share on telegram
Share on email

1 thought on “IoT Project, Setting up Keypad with the password”

Leave a Comment

Your email address will not be published.

You might also enjoy