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:33]
emilia_oana.mis
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:​hardware.png?​600|}}
 {{:​pm:​prj2022:​eb:​emilia_oana.mis:​software.jpeg?​600|}} {{:​pm:​prj2022:​eb:​emilia_oana.mis:​software.jpeg?​600|}}
Line 21: Line 20:
 ===== 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 39: 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 initialized. After the calibration of the joystick, the '​snake'​ message is shown on the LED matrix. 
-  * mediu de dezvoltare ​(if any) (e.g. AVR StudioCodeVisionAVR) + 
-  * librării şi surse 3rd-party ​(e.gProcyon AVRlib) +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:  
-  * algoritmi şi structuri pe care plănuiţi ​să le implementaţi +<​code>​generateFood()</​code>​ 
-  ​* ​(etapa 3) surse şi funcţii implementate+<​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. 
 + 
 +Alsoin order to easily debug the code, in the loop, the function ​ 
 +<​code>​dumpGameBoard()</​code>​ 
 +can be calledThis 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'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. 
 + 
 +default messages are provided: snake message, game over message, score message. Also, 10 (0-9digits may be written to the LED matrix, using the digits map.
 </​note>​ </​note>​
  
 ===== Results ===== ===== Results =====
  
-<note tip> 
-Care au fost rezultatele obţinute în urma realizării proiectului vostru. 
-</​note>​ 
  
-===== Conclusions =====+{{:​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 =====
 +{{:​pm:​prj2022:​apredescu:​snakeproject.zip|}}
  
 ===== Journal ===== ===== Journal =====
  
-<note tip> + 
-Puteți avea și o secțiune de jurnal în care să poată urmări asistentul de proiect progresul proiectului. + 25/05/2022 - wiki page completion 
-</note>+ 
 + 20/05/2022 - finished project 
 + 
 + ​18/​05/​2022 - finished writing the software part 
 + 
 + ​23/​04/​2022 - wiki page 
 + 
 + ​21/​04/​2022 - project selection 
 + 
  
 ===== Bibliography/​Resources ===== ===== 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.1650656016.txt.gz · Last modified: 2022/04/22 22:33 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