Differences

This shows you the differences between two versions of the page.

Link to this comparison view

pm:prj2022:apredescu:143 [2022/04/22 22:16]
emilia_oana.mis created
pm:prj2022:apredescu:143 [2022/06/01 22:15] (current)
emilia_oana.mis
Line 1: Line 1:
 ====== Snake Game ====== ====== Snake Game ======
 ===== Introduction ===== ===== Introduction =====
 +===== Mis Emilia Oana 1222B =====
 In this project I will implement the classical Snake game using a matrix. The game will be controlled by a joystick and the speed can be changed using a potentiometer. ​ In this project I will implement the classical Snake game using a matrix. The game will be controlled by a joystick and the speed can be changed using a potentiometer. ​
  
Line 13: Line 14:
  
  
-<note tip> 
-O schemă bloc cu toate modulele proiectului vostru, atât software cât şi hardware însoţită de o descriere a acestora precum şi a modului în care interacţionează. 
-</​note>​ 
  
 +{{:​pm:​prj2022:​eb:​emilia_oana.mis:​hardware.png?​600|}}
 +{{:​pm:​prj2022:​eb:​emilia_oana.mis:​software.jpeg?​600|}}
  
 ===== Hardware Design ===== ===== Hardware Design =====
  
-<note tip> + 
-Aici puneţi tot ce ţine de hardware design: +{{:pm:prj2022:​apredescu:​tinkercad_hardware.jpeg?600|}} 
-  * listă de piese +
-  * scheme electrice (se pot lua şi de pe Internet şi din datasheet-uri,​ e.g. http://www.captain.at/​electronic-atmega16-mmc-schematic.png) +
-  * diagrame de semnal  +
-  * rezultatele simulării +
-</​note>​+
 Parts List Parts List
   *LED Matrix ​   *LED Matrix ​
Line 38: Line 34:
  
 <note tip> <note tip>
-Descrierea codului aplicaţiei ​(firmware)+Developed using Arduino IDE. When the program starts, the pins and LED matrix ​(intensity, the display is cleared, etcare initializedAfter the calibration of the joystickthe '​snake'​ message is shown on the LED matrix.
-  * mediu de dezvoltare (if any) (e.g. AVR StudioCodeVisionAVR) +
-  * librării şi surse 3rd-party (e.g. Procyon AVRlib) +
-  * algoritmi şi structuri pe care plănuiţi să le implementaţi +
-  * (etapa 3) surse şi funcţii implementate +
-</​note>​+
  
-===== Rezultate Obţinute =====+For each loop, 4 actions are performed: generate food, scan for joystick input, update the snake, and calculate if the game is over. Those actions are performed by 4 functions:  
 +<​code>​generateFood()</​code>​ 
 +<​code>​scanJoystick()</​code>​ 
 +<​code>​calculateSnake()</​code>​ 
 +<​code>​handleGameStates()</​code>​ 
 +Each action was placed in a separate function in order to preserve code modularity, and allow for ease of expansion.
  
-<note tip+Also, in order to easily debug the code, in the loop, the function  
-Care au fost rezultatele obţinute în urma realizării proiectului vostru.+<code>dumpGameBoard()</​code>​ 
 +can be called. This function prints the game board to the serial monitor. 
 + 
 +To make the game easier to write, I created two structs: Point & Coordinate. The Point struct is used to store the coordinates of the snake'​s head and the coordinate of the food. At boot, the snake is initialized with a length of 3. The snake starts at a random position on the board, and the food is not placed anywhere. 
 + 
 +The snake'​s speed can also be changed, by updating the snakeSpeed variable. The higher the speed, the faster the snake moves. 
 + 
 +If the snake crosses an edge, it will appear on the other side of the screen. This is handled by the  
 +<​code>​fixEdge()</​code>​ function. 
 + 
 +3 default messages are provided: snake message, game over message, score message. Also, 10 (0-9) digits may be written to the LED matrix, using the digits map.
 </​note>​ </​note>​
  
-===== Concluzii ​=====+===== Results ​===== 
 + 
 + 
 +{{:​pm:​prj2022:​apredescu:​finalproject_mis_emilia_oana.jpg?​500|}} 
 +{{:​pm:​prj2022:​apredescu:​finalproject2_mis_emilia_oana.jpg?​500|}} 
 + 
 + 
 +Demo 
 +https://​www.youtube.com/​shorts/​UsnSqaREU1I 
 + 
 +===== Conclusions ===== 
 +This was my first arduino project and I am proud that I completed it in a few weeks. ​
  
 ===== Download ===== ===== Download =====
 +{{:​pm:​prj2022:​apredescu:​snakeproject.zip|}}
  
-<note warning>​ +===== Journal =====
-O arhivă (sau mai multe dacă este cazul) cu fişierele obţinute în urma realizării proiectului:​ surse, scheme, etc. Un fişier README, un ChangeLog, un script de compilare şi copiere automată pe uC crează întotdeauna o impresie bună ;-).+
  
-Fişierele se încarcă pe wiki folosind facilitatea **Add Images or other files**. Namespace-ul în care se încarcă fişierele este de tipul **:​pm:​prj20??:​c?​** sau **:​pm:​prj20??:​c?:​nume_student** (dacă este cazul). **Exemplu:​** Dumitru Alin, 331CC -> **:​pm:​prj2009:​cc:​dumitru_alin**. 
-</​note>​ 
  
-===== Jurnal =====+ ​25/​05/​2022 - wiki page completion
  
-<note tip> + 20/05/2022 - finished project
-Puteți avea și o secțiune de jurnal în care să poată urmări asistentul de proiect progresul proiectului. +
-</note>+
  
-===== Bibliografie/Resurse ​=====+ ​18/​05/​2022 - finished writing the software part 
 + 
 + ​23/​04/​2022 - wiki page 
 + 
 + ​21/​04/​2022 - project selection 
 + 
 + 
 + 
 +===== Bibliography/Resources ​=====
  
 <​note>​ <​note>​
-Listă cu documente, datasheet-uri, resurse Internet folosite, eventual grupate pe **Resurse Software** şi **Resurse Hardware**.+https://​components101.com/​displays/​8x8-led-matrix-module 
 + 
 +https://​components101.com/​resistors/​potentiometer 
 + 
 +https://​components101.com/​modules/​joystick-module 
 </​note>​ </​note>​
  
 <​html><​a class="​media mediafile mf_pdf"​ href="?​do=export_pdf">​Export to PDF</​a></​html>​ <​html><​a class="​media mediafile mf_pdf"​ href="?​do=export_pdf">​Export to PDF</​a></​html>​
  
pm/prj2022/apredescu/143.1650655001.txt.gz · Last modified: 2022/04/22 22:16 by emilia_oana.mis
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0