Table of Contents

Snake Game

Introducere

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.

Overview

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.

Block Diagram and hardware design

Component Amount
8×8 led matrix 1
Arduino Uno 1
Breadboard 1
Wires 11
Potentiometer 1

Software Design

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 )

Rezultate Obţinute

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.

Concluzii

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.

Download

GitHub repository: https://github.com/theahmadshaker/Arduino-Snake-Game/tree/main

Jurnal

20/11/2022: Watched a youtube video for a YouTuber called Sebastian Lague, a YouTuber that likes to tinker with electronics and programming projects. The video was about a handheld gaming console that can run the Snake game, Tetris, and a space shooter game, he then bundled the Arduino board and all of the components in a cardboard box and started using it. I loved the project. That day I became a fan of electronics and set out a plan to create the project myself, even if just a minified version of it.

Channel Link : https://www.youtube.com/c/SebastianLague Video Link : https://youtu.be/TURzbXTNaA0

06/03/2022 : After months of procrastination. Turns out that this semester I have a university subject in that I have to use Arduino boards, and for the subject, we have to submit a project at the end of the semester. Immediately my mind went back to the video I had watched a few months earlier and I finally have a reason and motivation to work on it.

25/04/2022: The time has finally come to start working on the project, I order a starter kit from aiautomation.ro. Two days later the parts arrive and I start working, I try to implement the logic I had recently used in a snake video game built for the web, using javascript, and try to implement it for a led matrix. After weeks and long hours of work, I managed to work a simple snake video game build for an 8×8 led matrix and Arduino Uno board and a joystick and the project was an ace.

Bibliografie/Resurse

https://create.arduino.cc/projecthub/rishab8551/arduino-snake-game-using-arduino-and-martix-6c230c https://aiautomation.ro/

Export to PDF