How To Control An LED Using Keypad

INTRODUCTION

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.

REQUIREMENTS

  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.

IoT

Step 2

Go to Arduino official website.

IoT

Step 3

Now, download the additional library for keypad.

IoT

Step 4

Go to Arduino Uno software -> Sketch -> Add file.

IoT

Step 5

New, a selection window will open. Select the file location for Kepad library and click OK.

IoT

Step 6

Got to Sketch-> Include Library -> Keypad.

IoT

Step7

Follow the circuit diagram.

IoT

Step 8

Follow the coding. We have initialized the keypad header file and and using our implementation. We have created keypad elements like 1,2,3  etc.

Then, using “If” condition, we have initialized the values and created a password.

IoT

Step 9

Upload the code to the Arduino board.

IoT

Step 10 - Verification of output

The LED will start blinking as per 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.

IoT

Summary

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 password keypad.

In future articles, we will see how to create a complete password protection system with a liquid Crystal LCD display.