This shows you the differences between two versions of the page.
|
pm:prj2025:mdinica:alin_ioan.alexandru [2025/05/28 00:08] alin_ioan.alexandru |
pm:prj2025:mdinica:alin_ioan.alexandru [2025/05/28 13:27] (current) alin_ioan.alexandru [Software Design] |
||
|---|---|---|---|
| Line 161: | Line 161: | ||
| return digitalRead(sigPin); | return digitalRead(sigPin); | ||
| } | } | ||
| + | |||
| + | </code> | ||
| + | |||
| + | Timer: | ||
| + | |||
| + | <code cpp> | ||
| + | |||
| + | volatile int timeRemaining = 0; // Init when game starts | ||
| + | volatile bool updateLCD = false; | ||
| + | |||
| + | void tick() { | ||
| + | if (timeRemaining > 0) { | ||
| + | timeRemaining--; | ||
| + | updateLCD = true; | ||
| + | } | ||
| + | } | ||
| + | |||
| + | void startTimer(int secunde) { | ||
| + | timeRemaining = secunde; | ||
| + | timerTicker.attach(1.0, tick); | ||
| + | } | ||
| + | |||
| + | void stopTimer() { | ||
| + | timerTicker.detach(); | ||
| + | timeRemaining = 0; | ||
| + | updateLCD = true; | ||
| + | } | ||
| + | |||
| + | </code> | ||
| + | |||
| + | Comunicare prin bluetooth: | ||
| + | |||
| + | <code cpp> | ||
| + | |||
| + | if (SerialBT.available()) { | ||
| + | String mesaj = SerialBT.readStringUntil('\n'); | ||
| + | mesaj.trim(); | ||
| + | mesaj.toLowerCase(); | ||
| + | |||
| + | if (mesaj == "start") { | ||
| + | startTimer(5 * 60); // 5 minute | ||
| + | SerialBT.println("Timer pornit"); | ||
| + | } else if (mesaj == "reset") { | ||
| + | stopTimer(); | ||
| + | SerialBT.println("Timer oprit/resetat"); | ||
| + | } else { | ||
| + | SerialBT.println("Comanda necunoscuta"); | ||
| + | } | ||
| + | } | ||
| </code> | </code> | ||
| Line 166: | Line 215: | ||
| ===== Rezultate Obţinute ===== | ===== Rezultate Obţinute ===== | ||
| - | <note tip> | + | Funcționalități implementate cu succes: |
| - | Care au fost rezultatele obţinute în urma realizării proiectului vostru. | + | * Detectarea mutărilor pe tabla de șah |
| - | </note> | + | * Interfață LCD funcțională pentru afișarea timpului |
| + | * Mod de joc 1v1 complet operațional | ||
| + | * Salvarea mutărilor în format digital | ||
| + | |||
| + | Limitări: | ||
| + | * Nu se detectează automat promovarea piesei – necesită intervenție de la utilizator | ||
| ===== Concluzii ===== | ===== Concluzii ===== | ||