In this project, I used the 4x4 keypad to create a program that allows the user to enter a password and a green LED will light up if correct, and a red LED will light up if incorrect.
The items need are as follows:
- Arduino Uno
- Jumper Wires x 13
- 220 (Ohm) Resistors x2
- Red and Green LED
- Membrance Switch Module 4x4 Keypad
Step 1: Step 1: Add the LEDs
- Place both LEDs to the breadboard
- Connect the smallest lead of both LEDs to the ground rail with a Jumper Wire
- Connect the 220 (Ohm) Resistor to the long lead
- Now, connect the long lead of both LEDs to the Arduino using a Jumper Wire
- Red = pin 13
- Green = pin 12
- Finally, connect a Jumper Wire from the ground rail on the breadboard to the GND pin on the Arduino.
Step 2: Step 2: Add the Keypad
- Connect the 4x4 Keypad to the Arduino
- Start connecting the keypad with Jumper Wires to pin 9, 8, 7, 6, 5, 4, 3, and 2 on the Arduino
This step is super easy and now to move on to the code.
Step 3: Step 3: the Code
Here's the code for the program. It will turn the Green LED on and print "Access Granted" on the serial monitor when the correct password is entered. When an incorrect password is entered, the program will turn the red LED on and print "Incorrect Password" to the serial monitor.