After working during the weekend, I have the circuit rigged up and everything seems to be connected correctly and working properly. After looking at and adapting some sample codes, which I have cited in my code, I have gotten a nice code working which functions pretty well for the game. I have gotten it so that pushing the button will start up the game with the snake in one set spot and the target in another randomly chosen spot. Then I have it set up so that when the unit is tilted the three-axis accelerometer will detect which way and move the snake appropriately. For example, when it is tilted forward the snake moves up and when tilted right it moves the snake right, etc. Then when the snake, which is indicated by green pixels, goes over a target, red pixels, the snake will gain one more pixel in length and another random target will be set up. Also, I have it set that with each target picked up one will be added to the players score. Then right now I have it set up so that if the snake goes off of the LED screen, a game over screen, which is basically a yellow/orange spiral starting in the middle and going to the edge, will play and then the player’s score will be displayed. Now, it is set up so that if the red button is pushed it will send the score of the game to Twitter.
I still have several features to work out and include in the project. For one, at the end when I have the score displayed I would like it so that if the power button is pushed it will restart the game, that way the reset button of the Arduino does not have to be pushed. I also need a few additional features to be added to the game, for example I would like for it to give a game over when the snake touches any part of itself, like the head hitting the tail. Also since the set up of Twitter does not like duplicate messages, I included the millisecond timer to add a more random variable which would help reduce the chance of duplicates. However, right now that timer gives values that are basically meaningless, partly because the millis function will loop around if it reaches the maximum int value, which happens rather quick. I also think it would be a good idea to have the snake move by itself, like if you tilt forward and the snake moves up, when you move back to flat the snake will continue to move up instead of just stopping into one pixel until it is moved again. These are the main issues and improvements I see that should be made at the moment. Also if memory allows I would like to incorporate the Piezo buzzer and have the device play a little song while the game is going on.