Differences

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

Link to this comparison view

pm:prj2025:avaduva:andrei_iulian.manea [2025/05/26 23:11]
andrei_iulian.manea [Journal]
pm:prj2025:avaduva:andrei_iulian.manea [2025/05/27 13:18] (current)
andrei_iulian.manea [Download]
Line 30: Line 30:
 1 x speaker\\ 1 x speaker\\
 1 X buzzer\\ 1 X buzzer\\
-1 X LED strip\\ 
-1 X LED\\ 
-3 X MOSFET N-MOS IRF540N transistor\\ 
 1 X 220Ohm resistor\\ 1 X 220Ohm resistor\\
 1 x XPT8871 mono audio amplifier\\ 1 x XPT8871 mono audio amplifier\\
Line 38: Line 35:
  
 **Circuit Layout**\\ **Circuit Layout**\\
-{{ :​pm:​prj2025:​avaduva:​pm_schema_cablaj_andrei_manea_2.jpg?300 |}}+{{ :​pm:​prj2025:​avaduva:​pm_schema_electrica_andrei_manea_final.png?300 |}}
  
 **Circuit Design**\\ **Circuit Design**\\
-{{ :​pm:​prj2025:​avaduva:​pm_schema_electrica_andrei_manea.jpg?300 |}}+{{ :​pm:​prj2025:​avaduva:​pm_schema_electrica_andrei_manea_final2.png?300 |}}
  
 **Circuit Implementation** **Circuit Implementation**
Line 115: Line 112:
 </​note>​ </​note>​
  
-===== Rezultate Obţinute =====+Given the fact that I have used two Arduino UNO, I have two separate codes. The first one runs the actual game logic and handles the input from the keyboard, allowing the player to move on the board. It also handles the timer for the buzzer, which makes a sound when the player has 2 seconds left for his turn. The second one is used to handle the speaker, taking the input from the microSD card reader.
  
-<note tip> +1. Tic-Tac-Toe Game 
-Care au fost rezultatele obţinute în urma realizării proiectului vostru+  * setup() 
-</note>+       * Initializes the TFT display via SPI (tft.initR()),​ clears the screen
 +       * Configures buttons (GPIO inputs with pull-ups), the buzzer pin (GPIO output), and seeds the random number generator using an ADC read. 
 +       * Calculates the grid’s starting coordinates,​ resets the game board, and starts the first turn timer. 
 +  * loop() 
 +       * End-of-Game Handling: If gameover is true, it shows either “Player X wins!”, “Player O wins!”, or “Draw!”;​ then waits resetDelay ms before clearing and restarting. 
 +       * Turn Timer 
 +            * Between warningThreshold and moveTimeout:​ sounds the buzzer via tone() (PWM) and displays a countdown once per second. 
 +            * After moveTimeout:​ automatically picks a random free cell for the current player, draws the mark, and checks for win/draw. If the game continues, it swaps players and resets the turn timer. 
 +            * Otherwise: silences the buzzer and clears any warning message. 
 +       * Input & Rendering: Reads button presses (debounced in software) to move the cursor or place a mark, then highlights the current cell and redraws any X/O. 
 +  * Supporting Functions 
 +       * Board management: resetBoard(),​ drawGrid(), highlightCell(),​ drawMark() 
 +       * Game logic: moveCursor(),​ placeMark(),​ checkWin(), isBoardFull() 
 +       * Turn management: startTurn(),​ clearWarningArea(),​ displayTimerWarning(),​ displayWinner(),​ displayDraw() 
 +       * Random fallback: randomMove() for timeouts
  
-===== Concluzii =====+2. Speaker 
 +  * setup() 
 +       * Initializes the SD card over SPI (chip-select on pin 10). 
 +       * Configures the TMRpcm library’s CS and speaker pins and sets playback volume. 
 +  * loop() 
 +       * If no audio is currently playing, calls audio.play("​powerup.wav"​).
  
 +Here is the full code: [[https://​github.com/​LilAndy2/​PM_Project]]
 +===== Results =====
 +
 +Here is a short demo of the game in action.
 +
 +[[https://​youtube.com/​shorts/​_YSpUl_ECTo?​feature=share]]
 +
 +===== Conclusions =====
 +  * It was a cute project which took me a lot of time to make. 
 +  * I had to learn the basics of Arduino from scratch and try to make something functional.
 +  * While the aesthetic can be improved by adding colors and decorations,​ it is the best I could do in the time given.
 +  * While the experience was very frustrating at times, it was also fun to learn something new.
 ===== Download ===== ===== Download =====
  
-<note warning>​ +Here is an archive with all the files of the project.
-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**. +{{:pm:prj2025:avaduva:pm_project_andrei_manea.zip|}}
-</​note>​+
  
 ===== Journal ===== ===== Journal =====
Line 136: Line 162:
 11.05.2025 - materials bought, starting on the hardware design\\ 11.05.2025 - materials bought, starting on the hardware design\\
 18.05.2025 - finished hardware design\\ 18.05.2025 - finished hardware design\\
-19.05.2025 - uploaded circuit design and circuit layout +19.05.2025 - uploaded circuit design and circuit layout\\ 
-26.05.2025 - implemented the software +23.05.2025 - decided that LED strip component does not fit with the current hardware, so I removed it\\ 
-===== Bibliografie/Resurse ​=====+26.05.2025 - implemented the software\\ 
 +27.05.2025 - filmed the demo of the game 
 +===== Bibliography ​Resources ​=====
  
-<​note>​ +__Hardware Resources__ 
-Listă cu documente, datasheet-uri, resurse Internet folosite, eventual grupate pe **Resurse Software** şi **Resurse Hardware**. +  * https://​docs.arduino.cc/​resources/​datasheets/​A000066-datasheet.pdf 
-</note>+  ​https://​shorturl.at/​ccQdk 
 +  ​https://​www.electrokit.com/​upload/​product/​41015/​41015739/​41015739_-_SD_Card_Module.pdf 
 + 
 +__Software Resources__ 
 +  ​https://​cdn-learn.adafruit.com/​downloads/​pdf/​adafruit-gfx-graphics-library.pdf 
 +  * https://​www.tinkercad.com/​projects/​Tic-Tac-Toe-Game-on-Arduino-for-Beginners
  
 <​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/prj2025/avaduva/andrei_iulian.manea.1748290284.txt.gz · Last modified: 2025/05/26 23:11 by andrei_iulian.manea
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