This is an old revision of the document!
The motivation for this project came from my love of video games, and because I believe that video games are essential in one's life. This sounds out of the ordinary, however, scientists believe that video games do greatly enhance the motor and intuitive skills of humans. And not to mention that studies have shown more significant levels of creativity in children that play video games.
The device can be packaged up and be used as a handheld gaming console, for now, it can only run the classic snake game, and only on an 8×8 led matrix screen. The snake can be moved using a potentiometer (Joystick) connected to the Arduino that manipulates the led matrix' display as if it was a snake game.
The IDE used was the Arduino IDE, with the Led Control library, no external libraries nor game engines were used. However, it was initially tested online on TinkerCAD before finalizing the purchase of the parts and code.
The signals sent by the potentiometer tell the Arduino the current direction of the joystick, depending on that, the snake changes direction accordingly, and the apple on screen is displayed using two random integers for x and y coordinates.
The snake location is determined by a 2D array, with each subarray containing coordinates of the light's position, each time the snake eats an apple, the size is incremented by one.
The game is lost when the snake hits itself (any part of its body), the borders of the screen do not end your game ( I made it that way due to screen size limitations )
After a few days of work, the final result was a success. After a few faulty wire changes and a thousand google searches, the game finally worked perfectly. The video game turned out to be a success.
This is the first time I've worked on an Arduino Project, I learned the basics of electronics during this class and especially during the project. I bought a starter kit to work on future side projects. Loved the experience.
GitHub repository: https://github.com/theahmadshaker/Arduino-Snake-Game/tree/main