Giter Site home page Giter Site logo

whack-a-mole's Introduction

Whack-a-Mole

Hardware Components: • Arduino UNO • LEDs (7) • Resistors 221 ohm(7) • Analog Joystick • Jumper Wires • Male/Female Jumper Wires

Theory: This "Whack-a-mole" game uses 7 LED's, and a joystick. There are 4 "moles", represented by the 2nd, 3rd, 4th, and 5th lights from the left on my board. One of the four lights will randomly light up and give a set amount of time to hit the corresponding direction on the joystick. I have arranged my lights so that, from left to right, the selections on the joystick are: left, up, down, right. This is just the convention that I chose, so creative and try other ones! The two lights on the left are red and green, which indicate a incorrect or correct choice. The yellow light to the far right blinks the count for the current high score, and it indicates the score every time a run is over (whenever a wrong choice is made). Naturally, a new high score replaces the old one. Perhaps the most complicated part of this project is the analog joystick. For both directions of the joystick, there are max values of 0 and 1024 (for mine, I had to use 1023, so if you aren't getting the selections correct, you can try that). I believe these values can be measured as well using a serial window. I simplified these input values using switch statements for both the x and y inputs. I am not sure if this is the best way to do it, but because I only needed the max values of each direction (i.e, only 4 options, 4 LED moles) I assigned integer values to each possibility: 1, 2, 3, 4 corresponding to Left, Right, Up, Down.

whack-a-mole's People

Contributors

aradhyas avatar

Stargazers

 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.