Introduction: Buzzwire Time Trials

About: I'm a maker in Chicago, IL, originally from Tucson, AZ. I like things that involve electronics, art, biology, and sound.

This Instructable is for an alternate version of code for the BuzzWire game I built in this instructable. The other version housed a clue for a scavenger hunt. This version acts as a standalone game that tracks how long it takes you to complete, and displays the high score (shortest amount of time). The only difference is the code. The build and circuit are the same, so please reference the other instructable for those pieces.

Step 1: The Code

The updated code is attached and also on my github page.

The board will initially display the high score, then displays a running clock as you play the game. Upon completion, if your score is better than the high score, the high score will be updated and you will be congratulated. There is also a piezo buzzer and LEDs to let you know if you fail.

Another nice feature that I implemented is a switching start. When you complete the game, the end washer becomes the new start washer, so the next round you will play in reverse (no need to reset). Also, if you fail, whichever washer you touch next will be the new start point. This allows for quicker reset, and allows you to play the game in reverse.

Note that the high score is stored in the internal EEPROM, so you can turn the Arduino off and it will keep the high score. If it is your first time uploading, you must uncomment the lines to reset the high score (in void setup()), then comment them out again and re-upload the sketch so that the score doesn't reset every time you reset the board. This is necessary because "resetting" the high score actually means saving an arbitrarily large value, since the goal of the game is to get the lowest time possible. Now that I'm writing this, I suppose an If statement that checks weather there is anything written to the EEPROM address yet would also work. That's a better idea. You should change the code to do that.

Step 2: Enjoy!