0% found this document useful (0 votes)
15 views17 pages

Ie Robotics

The document outlines the design and functionality of a math quiz game using Arduino, featuring a 16x2 LCD and a 4x3 keypad. It details essential functions for pin control, LCD operations, and keypad input, along with hardware requirements and pin mappings. The game generates random questions, tracks scores, and utilizes EEPROM for high score storage.

Uploaded by

Lavanya Ranvee
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views17 pages

Ie Robotics

The document outlines the design and functionality of a math quiz game using Arduino, featuring a 16x2 LCD and a 4x3 keypad. It details essential functions for pin control, LCD operations, and keypad input, along with hardware requirements and pin mappings. The game generates random questions, tracks scores, and utilizes EEPROM for high score storage.

Uploaded by

Lavanya Ranvee
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 17

The Institution of Engineers, NITK Chapter

IE ROBOTICS
The Institution of Engineers, NITK Chapter

IE ROBOTICS
The Institution of Engineers, NITK Chapter
The Institution of Engineers, NITK Chapter

Function What It Does


pinMode() Sets a pin as input or output
digitalWrite() Sends HIGH or LOW signal
digitalRead() Reads digital input (button, etc.)
analogRead() Reads analog value from A0–A5
analogWrite() Sends analog (PWM) signal
delay() Pauses the program
millis() Returns time (in ms) since start
Serial.begin() Starts serial communication
Serial.print() Prints text to Serial Monitor
The Institution of Engineers, NITK Chapter

A simple math quiz game built using Arduino.


Uses a 16x2 LCD and a 4x3 keypad interface.
Generates random math questions and checks user answers.
Score tracking and high score memory using EEPROM.
Includes buzzer sounds and reset functionality for real-time gameplay.
The Institution of Engineers, NITK Chapter

Arduino UNO
16x2 LCD Display
4x3 Matrix Keypad
Buzzer
Resistors & Wires
Breadboard
Potentiometer
Power Supply / USB cable
The Institution of Engineers, NITK Chapter

pin mappings:

LCD: RS->6, EN->5, D4->4, D5->3, D6->2, D7->1


Keypad Input Pins: 7, 8, 9, 10
Keypad Output Pins: 11, 12, 13
Reset Pin: A0
Buzzer: A1
The Institution of Engineers, NITK Chapter


Start Screen Press any key to start
Random math question appears
User enters answer using keypad

If correct +1 score & next question

If wrong or time exceeds 10s Game over
Displays final score and stores high score in EEPROM
The Institution of Engineers, NITK Chapter

LiquidCrystal.h

EEPROM.h
The Institution of Engineers, NITK Chapter

1. What is a 16x2 LCD?


A 16x2 LCD (Liquid Crystal Display) is a display module that can show 16
characters per line and has 2 such lines.

2. Modes of Operation
A. 8-bit Mode
Uses all D0–D7 data lines
Sends full byte at once
Rarely used to save pins
B. 4-bit Mode (common)
Uses only D4–D7
Sends data in two nibbles (4 bits at a time)
Saves pins, works perfectly for most projects
The Institution of Engineers, NITK Chapter

LiquidCrystal lcd(RS, E, D4, D5, D6, D7);

LCD Pin Arduino Pin What it Does

RS (Register Select) Pin 6 Tells the LCD if we are sending commands or data/text

Used to send data to the screen when it changes from LOW to


EN (Enable) Pin 5
HIGH

D4 Pin 4 Data pin to send bits (we're using 4-bit mode)

D5 Pin 3 Another data pin

D6 Pin 2 Another data pin

D7 Pin 1 Another data pin

**Arduino library supports 4-bit mode by default to keep things simple and save pins.
The Institution of Engineers, NITK Chapter

Important Functions in LiquidCrystal.h

Function What It Does


lcd.begin(16, 2) Initializes LCD with 16x2 display
lcd.print("text") Displays text
lcd.setCursor(col, row) Moves cursor to column & row
lcd.clear() Clears the display
lcd.blink() Makes cursor blink
lcd.noBlink() Stops blinking
lcd.cursor() Shows the cursor
lcd.noCursor() Hides the cursor
lcd.scrollDisplayLeft() Scrolls screen left
lcd.scrollDisplayRight() Scrolls screen right
The Institution of Engineers, NITK Chapter

1. Physical Structure
Matrix Configuration: 4 rows (R1–R4) and 4 columns (C1–C4)
Total Keys: 16 (4 rows × 4 columns)

2. How it works:
Microcontroller sets one row LOW at a time, others HIGH.
It reads all columns.
If a column is LOW, it means a button in that row and column intersection is
pressed.
Repeat for each row to identify exactly which button was pressed.
This method is called row-column scanning.
The Institution of Engineers, NITK Chapter

const int inputs[4] = {7, 8, 9, 10}; // Rows


const int outputs[3] = {11, 12, 13}; // Columns

Pin Type Pins Mode Why

Outputs 11, 12, 13 OUTPUT To activate one column at a time

To detect button press (goes LOW


Inputs 7, 8, 9, 10 INPUT_PULLUP
when pressed)

Arduino sets column pins LOW one by one


At the same time, it checks if any of the row pins go LOW
If pin 12 (column 1) is LOW and pin 8 (row 2) becomes LOW → you pressed ‘5’!
The Institution of Engineers, NITK Chapter

#define BUZZER A1
pinMode(BUZZER, OUTPUT);

You connect buzzer to A1


Then you use tone(BUZZER, frequency, duration) to make sound
noTone(BUZZER) stops sound
The Institution of Engineers, NITK Chapter
HIMANSHI - 7976744872

You might also like