How To Control An LED Using Keypad


In this article, we are going to see how to add an additional keypad library and we will see how to control an LED using keypad by assigning a password character to it.
Initially, we will install the additional keypad library from Arduino's official website and add it to the library of Arduino. We are going to see how to code for the keypad.
  1. Arduino UNO
  2. Keypad
  3. LED
  4. Connecting wires
  5. Arduino UNO Software
Steps to follow
Step 1
Open the Arduino UNO software installed in your device.
Step 2
Go to Arduino official website.
Step 3
Now, download the additional library for the keypad.
Step 4
Go to Arduino Uno software -> Sketch -> Add file.
Step 5
New, a selection window will open. Select the file location for the Keypad library and click OK.
Step 6
Got to Sketch-> Include Library -> Keypad.
Step 7
Follow the circuit diagram.
Step 8
Follow the coding. We have initialized the keypad header file and using our implementation. We have created keypad elements like 1,2,3  etc.
Then, using the “If” condition, we have initialized the values and created a password.
Step 9
Upload the code to the Arduino board.
Step 10 - Verification of output
The LED will start blinking as per the password allotment. Green will blink if the password is correct and Red LED will blink if the password is wrong. I have used 7 as my password and if it is true the LED will blink.


In this article, we saw how to include an additional library in Arduino UNO software. We came to know how to create a password-controlled LED using a password keypad.
In future articles, we will see how to create a complete password protection system with a liquid Crystal LCD display.

Similar Articles