Week 2 Assignment

Matt Parker

 

Lesson 3: 10k Ohm resisters going to ground == good

If you have an input going into your Ardunio, make sure you also have a 10k Ohm resister going to ground. Otherwise, you're in for some funky results. Random inputs that randomly change, which is cool if you're trying to make a random blinking LED display, less cool if you're trying to make something that makes sense.

Result: Wood Block Even/Odd Game

Even/Odds is similar to Rock/Paper/Scissors, except apparently no one outside of me and my friends has ever heard of it or played if growing up. Also, instead of a player choosing between Rock, Paper, and Scissors, they can only choose to put out 1 finger or 2. One player wants to get the result of the fingers added up to be even, the other player wants it to be odd. The advantage of the wood blocks version of this game is that the result is indicated before the player has to reveal what value they choose (thus preventing cheating).

To make this game, I created a board and 4 wooden blocks. When there is nothing on the board, or only 1 block, the Yellow LED lights up indicating the winner has not been determined yet.

When both blocks are on the board, the red LED (Even) will light up if the result of number on the blocks is even. If the result of the numbers on the blocks is odd, the green LED will light up.

The wooden blocks function as switches, do to the copper mesh attached to the bottom of the blocks. The even blocks complete one circuit, the odd blocks complete another, because the copper mesh is aligned differently on the bottom of these blocks. Based on which switch is completed, the program will get an input into the digital in of the ardunio, and thus be able to tell if the result is even or odd.