This project demonstrates a simple calculator built using an Arduino microcontroller. The calculator can perform basic arithmetic operations such as addition, subtraction, multiplication, and division.
- Arduino Board: Any compatible Arduino board (e.g., Arduino Uno, Nano, etc.)
- 4x4 Matrix Keypad: To input numbers and operations.
- 16x2 LCD Display: To display the input and output results.
- Breadboard and Jumper Wires: For connecting components.
The following libraries are used in this project:
- Keypad: For handling input from the 4x4 matrix keypad.
- LiquidCrystal: For controlling the 16x2 LCD display.
Make sure to install these libraries via the Arduino Library Manager before uploading the code.
The main code for the calculator is found in the prot_project_co.ino file. Below is a brief explanation of the code structure:
- Include Libraries: The required libraries are included at the top of the code.
- Define Constants: Constants for the LCD pins and keypad layout are defined.
- Create Objects: Objects for the keypad and LCD display are created.
- Initialize Variables: Variables for storing the operands, operator, and result are initialized.
- Display Welcome Message: A welcome message is displayed on the LCD.
- Keypad Input Handling: The loop continuously checks for key presses on the keypad.
- Perform Calculations: Based on the input, the program will perform the corresponding arithmetic operation.
- Basic Arithmetic Functions: Functions for addition, subtraction, multiplication, and division are defined.
- Display Function: A function to display results on the LCD is implemented.
- Wiring: Connect the keypad and LCD display to the Arduino according to the circuit diagram.
- Upload Code: Upload the
prot_project_cofile to your Arduino board using the Arduino IDE. - Power Up: Connect your Arduino to a power source.
- Input: Use the keypad to input numbers and select operations. The results will be displayed on the LCD.
- To add two numbers, input the first number, press the
+key, input the second number, and press the=key to see the result. - Similarly, use
-,*, and/for subtraction, multiplication, and division, respectively.
This basic calculator demonstrates the use of Arduino for handling user input and performing calculations. You can expand the functionality by adding more operations or improving the user interface.
- Implement error handling for division by zero.
This project is open-source. Feel free to modify and distribute it under the MIT License.