This shows you the differences between two versions of the page.
pm:prj2025:eradu:andrei.gheta [2025/05/10 16:20] andrei.gheta [Hardware Design] |
pm:prj2025:eradu:andrei.gheta [2025/05/29 19:32] (current) andrei.gheta [Hardware Design] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Simon says 1v1 ====== | + | ====== Simon Says 1v1 ====== |
===== Introduction ===== | ===== Introduction ===== | ||
- | <note tip> | ||
**Project Overview:** | **Project Overview:** | ||
Line 19: | Line 18: | ||
This project is both entertaining and educational. It helps players train their memory and reflexes, and for us, it was a great way to improve our understanding of microcontroller programming, real-time interaction, and electronics. | This project is both entertaining and educational. It helps players train their memory and reflexes, and for us, it was a great way to improve our understanding of microcontroller programming, real-time interaction, and electronics. | ||
- | </note> | ||
===== Description ===== | ===== Description ===== | ||
Line 36: | Line 34: | ||
===== Hardware Design ===== | ===== Hardware Design ===== | ||
- | <note tip> | ||
**Components:** | **Components:** | ||
| | ||
- | - Arduino Mega 2560 | + | - Arduino Mega 2560 R3 |
- | - Buttons | + | - Push Button x8 |
- | - LEDs | + | - LEDS: |
+ | - 5 mm Green LED with Diffused Lens x2 | ||
+ | - 5 mm Yellow LED with Diffused Lens x2 | ||
+ | - 5 mm Red LED with Diffused Lens x2 | ||
+ | - 5 mm Blue LED with Diffused Lens x2 | ||
- | - wires | + | - Male-Male Wires |
- | - resistors | + | - 2.2K Ω Resistor x8 |
- | - buzzer | + | - 3 V or 3.3V Passive Buzzer |
- | * 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 | + | **Electrical Scheme:** |
- | </note> | + | |
+ | {{:pm:prj2025:eradu:simon.png?600|}} | ||
===== Software Design ===== | ===== Software Design ===== | ||
+ | **IDE:** | ||
- | <note tip> | + | Arduino IDE |
- | Descrierea codului aplicaţiei (firmware): | + | |
- | * mediu de dezvoltare (if any) (e.g. AVR Studio, CodeVisionAVR) | + | |
- | * 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 ===== | + | Platform: Arduino Mega |
- | <note tip> | + | Programming language: C/C++ with Arduino core |
- | Care au fost rezultatele obţinute în urma realizării proiectului vostru. | + | |
- | </note> | + | |
- | ===== Concluzii ===== | + | Serial Monitor used for debugging and feedback |
- | ===== Download ===== | + | **Data Structures:** |
- | <note warning> | + | - int sequence[]: holds the sequence of LED/button indices |
- | 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**. | + | - int playerInputs[]: stores player responses |
- | </note> | + | |
- | ===== Jurnal ===== | + | **Algorithms:** |
- | <note tip> | + | - Random sequence generator: generateSequence() generates a sequence using random() |
- | Puteți avea și o secțiune de jurnal în care să poată urmări asistentul de proiect progresul proiectului. | + | |
- | </note> | + | |
- | ===== Bibliografie/Resurse ===== | + | - Sequential LED display with timing: LED patterns displayed with delay |
- | <note> | + | - Input verification algorithm: compares player inputs to generated sequence |
- | Listă cu documente, datasheet-uri, resurse Internet folosite, eventual grupate pe **Resurse Software** şi **Resurse Hardware**. | + | |
- | </note> | + | - Scoring system: increments player scores on success |
+ | |||
+ | - Game state machine: manages rounds, turns, and game over conditions | ||
+ | |||
+ | - PWM brightness control for LEDs | ||
+ | |||
+ | - Timeout-based input wait: waitForChoice() uses millis() for timing player responses | ||
+ | |||
+ | |||
+ | **Pseudocode:** | ||
+ | |||
+ | START game | ||
+ | INIT hardware (LEDs, buttons, PWM, Timer, Serial) | ||
+ | LOOP until gameOver: | ||
+ | FOR each round: | ||
+ | SET currentPlayer to 1 | ||
+ | generateSequence() | ||
+ | displaySequence() | ||
+ | INCREMENT sequence length | ||
+ | IF player 1 fails → gameOver = true | ||
+ | |||
+ | WAIT | ||
+ | SET currentPlayer to 2 | ||
+ | displaySequence() | ||
+ | INCREMENT sequence length | ||
+ | IF player 2 fails → gameOver = true | ||
+ | |||
+ | IF both players succeeded | ||
+ | CONTINUE | ||
+ | |||
+ | DISPLAY winner | ||
+ | WAIT for any button press | ||
+ | RESET game state | ||
+ | RESTART game | ||
+ | |||
+ | |||
+ | |||
+ | ===== Results ===== | ||
+ | |||
+ | The project works as intended: the game correctly handles player turns, detects mistakes, increases difficulty, and displays the winner. All hardware components function properly, and the game resets and restarts as expected. | ||
+ | |||
+ | ===== Conclusions ===== | ||
+ | |||
+ | The project successfully demonstrates the use of microcontroller peripherals to create an interactive memory game. It helped reinforce my understanding of hardware-software integration and real-time programming. | ||
+ | |||
+ | |||
+ | ===== Resources ===== | ||
- | <html><a class="media mediafile mf_pdf" href="?do=export_pdf">Export to PDF</a></html> | + | Github: https://github.com/andreigheta/simon-says-1vs1/ |