In this Project i am going to show you ,How to make a simple magic game on Arduino(Nano or UNO).You can trick your friends using this project and be a star in front of them.
Step 1: The Components Required
For doing this Project You essentially need components like
1 >> Arduino NANO or UNO.
2 >> HD44780 16x2 character LCD.
3 >> 4x4 keypad matrix.
4 >> Breadboard and jumper wires.
Arduino NANO-The Arduino Nano is a small, complete, and breadboard-friendly board based on the ATmega328; offers the same connectivity and specs of the UNO board in a smaller form factor.
The Arduino Nano is programmed using the Arduino Software (IDE), our Integrated Development Environment common to all our boards and running both online and offline.
HD44780 16x2 character LCD-The Hitachi HD44780 LCD controller is an alphanumeric dot matrix liquid crystal display (LCD) controller developed by Hitachi that was commonly used during the MCS-51 era. It was made commercially available around year 1987.The character set of the controller includes ASCII characters, Japanese Kana characters, and some symbols in two 28 character lines. Using an extension driver, the device can display up to 80 characters.
4x4 keypad matrix -
The pattern of key pad is as shown above.
Step 2: The Connection Diagram
The Connection Diagram is as shown above.See the video also to get the correct understanding about the project.
connect as per the description
The Arduino circuit connection for LCD:
* LCD RS pin to analog pin A0
* LCD Enable pin to analog pin A1
* LCD D4 pin to analog pin A2
* LCD D5 pin to analog pin A3
* LCD D6 pin to analog pin A4
* LCD D7 pin to analog pin A5
The Arduino circuit connection for MAtrix Key Pad:
* ROW1 pin to digital pin 5
* ROW2 pin to digital pin 4
* ROW3 pin to digital pin 3
* ROW4 pin to digital pin 2
* COLUMN1 pin to digital pin 6
* COLUMN2 pin to digital pin 7
* COLUMN3 pin to digital pin 8
* COLUMN4 pin to digital pin 9
Step 3: The Code Explanation
This code essentially works on a linear mathematical equation ..
in loop function i have written many hirarcheal while (1) loops for each stages.
I have also coded A to work as reset and B to go back to the previous step,
In the innermost loop of the code i have written the math logic
num=(num*10)+(key-48); -------means that each key press the ascii value is converted to the integer format and converting in to a final whole number until star key is pressed
and (num - A SECRET NUMBER) will give you age and birth month.To know that see the video.
ie num%100 = age, num/100 gives you the month.
That is it for the code
if you have any doubt feel free to contact me my mail id is firstname.lastname@example.org
check my website for more info: