I made a board that will play people in Rock Paper Scissors. It has three buttons and three LEDs. To start a game, hold down all three buttons. The LEDs will flash as a count down, and then you press your choice of buttons, and the chip shines an LED. The chip determines who won, and flashes either 10 rapid blinks (person won), 1 rapid blink (chip won), or 1 long blink (tie).
I designed the circuit in Eagle (see the board and the schematic):
I learned that you should always run drc (design rule check) carefully in Eagle before printing -- my first board had two pins incorrectly wired together, and didn't work. I had already hot-glued the whole thing before realizing it didn't work -- another mistake:
I corrected it, and also added diagrams (instead of letters) to represent Rock, Paper and Scissors:
I cut it on the Vinyl cutter (force 59, speed 2.5), weeded the traces, and soldered the parts on. I initially soldered on the wrong resistors, but Nadya noticed the error, and after I fixed them it was good:
Next, I tried to program it, using my fabISP and the terminal. I had tried this out two weeks ago, so started off with a similar program to what I'd used then. With CrossPack installed, and everything plugged it, I navigated to a folder with the .c and .c.make files, and ran:
sudo make -f RockPaperScissors.c.make
sudo make -f RockPaperScissors.c.make program-usbtiny-fuses
sudo make -f RockPaperScissors.c.make program-usbtiny
I started off with some simple things, like getting the lights to turn on, and responding to a button push:
After many iterations, I made some .c and .c.make code I was happy with. The trickiest part was generating random moves for the chip. I did this by triggering the chip's move on the precise amount of time it took for the person to hit the button last move. It works pretty nicely. Here I am playing Rock Paper Scissors against the board:
I made a battery cable for the board, using a 5V voltage regulator, 9V battery case, and some hot glue to solidify it. I wanted to be able to power it without plugging in to the wall or a computer. It worked quite well at first, but the battery started dying (it wasn't new, and I also left it plugged in to the board for a while). This made the LEDs quite dim. I'll have to replace the battery, and only plug it in when I need to use it.