Project tutorial
Guess the Number with Arduino KeyPad

Guess the Number with Arduino KeyPad © GPL3+

A simple and funny project with an Arduino UNO and the famous keypad shield. Arduino selects a random number, you guess the number.

  • 2,609 views
  • 3 comments
  • 3 respects

Components and supplies

Apps and online services

About this project

This is a simple and funny project with an Arduino UNO and the famous "keypad shield".

The Keypad shield is a famous shield for Arduino UNO that has an LCD and 5 switch buttons. You can use the LCD and buttons for creating everything you want. The most projects use the Arduino UNO and the keypad shield like datalogger. I want to use my Arduino UNO and keypad for making the famous "Guess The Number Game".

Do you know the game?

It's really simple. The goal of the game is the secret number. Arduino UNO chooses a number, and you must discover this. You have only 5 possibilities. The sequence of the game is:

1. Arduino chooses a number. This is the secret number.

2. You can choose the number on the screen by using two switches and after the choosing, you can confirm your number.

3. If the number that you have chosen is the secret number, you have won. Else, Arduino gives a tip like "The secret number is more biggest".

4. After 5 attempts, if you not have discovered the secret number, you have loose the game.

I love this game!

Materials

For this project you must have a few of components:

You can buy the Arduino UNO on Amazon or GearBest. The keypad shield is a famous shield that has an LCD and 5 switches. The 16x2 LCD is connected to the Arduino UNO, and the switch has differents value of resistors.

When you switch on a switch, Arduino read a resistance value. In the game, you can read the resistance, and start an "if" block. On the internet, there are many keypad examples.

You can buy the Arduino UNO Keypad on Amazon or GearBest .

Optional:

3D printed "Arduino UNO keypad shield (https://www.thingiverse.com/thing:123636)

The Code

Now you can upload the code into your Arduino UNO board.

First of all connect the shield to your Arduino UNO, after connecting the Arduino UNO to your computer, and upload the sketch.

You can see the code by using this link: https://github.com/masteruan/GuessNumber.

Done?

Now you have your personal Guess The Number Game.

I've printed the case of the game. You can print the case by using the link on Thingiverse . Download the file and print yourself the case, or print the object into a Fablab.

Code

Guess the Number on Arduino UNO Keypad Shield
This is the code for the Guess the number game with Arduino UNO and Keypad Shield.

Comments

Similar projects you might like

Arduino Keyless Door Lock System with Keypad and LCD

Project tutorial by DIY Hacking

  • 15,297 views
  • 9 comments
  • 43 respects

Only Three Pins for a 4x3 Keypad

Project tutorial by Giovanni Carrera

  • 1,236 views
  • 1 comment
  • 11 respects

Using 4×4 Keypad With Arduino

by Techmirtz

  • 22,275 views
  • 6 comments
  • 29 respects

OSEPP LCD and keypad shield

Project tutorial by Joe

  • 38,847 views
  • 27 comments
  • 50 respects

I2C Matrix Keypad With PCF8574/PCF8574A GPIO and Visuino

Project tutorial by Boian Mitov

  • 6,084 views
  • 4 comments
  • 20 respects

Tweet using Arduino, ESP and Keypad

Project tutorial by STEMpedia

  • 2,111 views
  • 0 comments
  • 9 respects
Add projectSign up / Login