This circuit utilizes an Arduino UNO microcontroller and a 4x4 keypad to create an interactive input system. The keypad allows users to input numeric values and commands, which are then processed by the Arduino. The pressed keys are displayed on the Serial Monitor for feedback.
#include <Keypad.h>
// Define the number of rows and columns in the keypad
const byte ROWS = 4;
const byte COLS = 4;
// Define the keymap
char keys[ROWS][COLS] = {
{'1','2','3','A'},
{'4','5','6','B'},
{'7','8','9','C'},
{'*','0','#','D'}
};
// Connect keypad ROW0, ROW1, ROW2, ROW3 to these Arduino pins
byte rowPins[ROWS] = {2, 3, 4, 5};
// Connect keypad COL0, COL1, COL2, COL3 to these Arduino pins
byte colPins[COLS] = {6, 7, 8, 9};
// Create the Keypad
Keypad keypad = Keypad(makeKeymap(keys), rowPins, colPins, ROWS, COLS);
void setup() {
Serial.begin(9600); // Initialize serial communication at 9600 baud
}
void loop() {
char key = keypad.getKey(); // Get the key pressed
if (key) { // If a key is pressed
Serial.println(key); // Print the key to the Serial Monitor
}
}
This documentation provides a comprehensive overview of the circuit, detailing the components used, their connections, and the code that drives the functionality of the system.