Handheld Electronic Game Part 2


Click on images to enlarge. 

 

 

 

 

 

High on the success of my first handheld electronic game , I decided to build a second one. Mainly, I was disappointed that I didn't have enough memory to include the stdlib rand() function, so none of my games had any randomness associated with them. This game would be a rock, paper, scissors game. 

I always start with the software. I have an STK500 hooked up to my old 300 Mhz Debian box that I use for programming. I stuck with the Atmel ATTiny2313 micro-controller because I had them left over from a previous digi-key order.  

The code and the make file can be found here. The only part that I consider worth mentioning outside of the code itself is that I had to put the call to the rand() function within the while loop that waits for the user input. This is because if you put it outside that loop, it becomes predictable.

The hardware is always the tricky part for me. I always prototype it on my little bread board first, but basically this was the same hard ware configuration that I used on my first handheld electronic game . I hooked up the LEDs to Port B, and the 3 switches to Port D. I used the LM7805 and instructions I found here to power the whole thing.

After I had everything working on the bread board. I drilled holes into the project enclosure and glue gunned the 6 LEDs into place. Then I drilled larger holes for the 3 switches (one for each choice: rock, paper, or scissors). Then I soldered everything together. 

At the end I realized that my project case was too small for this project. In fact, I can't jam the battery into the case with all the other wires and junk. Since I didn't have a power switch around the house, this turned out to be useful, I just turn it off and on by plugging in the battery.

Here's a video of it working.