Giter Club home page Giter Club logo

arduino_number_guessing_game's Introduction

Arduino Number Guessing Game

An Arduino based implementation of a game where the player is given 6 chances to guess a number between 1 and 100 with each guess revealing if the number is higher or lower.

Software

To compile the software side on Linux, install platformio, if required make changes to src/main.cpp and:

cd arduino_number_guessing_game
# pio run -t compiledb # Run this if your code editor uses an LSP
pio run # Compile code without uploading to board

If this is successful you know the code compiles, after wiring can use pio run -t upload to flash the bytecode to the board.

Hardware and Flashing Code to Board

This project is built with these parts from the Elegoo Complete Starter Kit:

  • Arduino Uno R3
  • Solderless Breadboard with M-M and F-M jumper wires
  • MAX7129 LED Matrix
  • LCD 1602 module
  • Breakout IR receiver module
  • IR Remote (NOTE: if you are not using Elegoo IR remote you may need to update IR codes in src/main.cpp)

Wiring schematic below, might not be super clear, also refer to pin numbers defined in source code against your own wiring(e.g. IR receiver signal wire is defined as digital pin 2). IR receiver signal pin may be in middle rather than on left as shown in this diagram as it depends on your specific module:

Schematic

Once Arduino board is connected with USB, can flash new code: cd arduino_number_guessing_game && pio run -t upload.

The USB connection can then be used to provide 5V power to the Arduino board and if the wiring is correct the project should run. Point the IR remote in direction of IR receiver and start guessing. If LCD screen isn't visible, then try turning the potentiometer to change contrast, otherwise check all wiring is correct.

Images

A couple glary images of the game:

img1.jpeg img2.jpeg

Contributing

Can open a PR or fork repo etc., examples:

  • Currently the remaining turns are indicated by a decreasing number of columns being lit on the matrix. Could update this to go from numbers 6-0 and then maybe a W or an L for win/loss at end of a round. Had trouble finding code examples for representing alphanumerics using the LedControl library.
  • Add support for alternative inputs such as a keypad membrane switch, as using an IR remote can be tedious for typing in each number.
  • There is a bug where if the user enters something like "000" they cannot backspace these 0 digits and if they then enter "5" it becomes "500". This is an issue with how the digit addition/removal handles 0s.
  • On the hardware side, something like a 3D printed enclosure that holds the IR receiver, LCD and matrix in-place would make it look a lot better than hanging 2 modules on by F-M wires.

arduino_number_guessing_game's People

Contributors

mark-ruddy avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.