This shows you the differences between two versions of the page.
|
pm:prj2021:apredescu:wirebuzz [2021/06/04 14:33] vladislav.stratila [Rezultate Obținute] |
pm:prj2021:apredescu:wirebuzz [2021/06/04 14:58] (current) vladislav.stratila [Rezultate Obținute] |
||
|---|---|---|---|
| Line 50: | Line 50: | ||
| In cazul in care pinul 3(end) trece in starea LOW iar pinul 2(start) ramane in starea HIGH inseamna ca firul a atins partea de jos a diodei si runda a fost castigata.Se reda un sound diferit de cele anterioare si se afiseaza pe LCD mesajul "You Win The Game". | In cazul in care pinul 3(end) trece in starea LOW iar pinul 2(start) ramane in starea HIGH inseamna ca firul a atins partea de jos a diodei si runda a fost castigata.Se reda un sound diferit de cele anterioare si se afiseaza pe LCD mesajul "You Win The Game". | ||
| - | Code: | + | ===== Rezultate Obținute ===== |
| + | DEMO: https://www.youtube.com/watch?v=K5ur96gdY-g | ||
| - | <code>#include <LiquidCrystal.h> | ||
| - | const int RS = 8; | ||
| - | const int EN = 9; | ||
| - | const int d4 = 4; | ||
| - | const int d5 = 5; | ||
| - | const int d6 = 6; | ||
| - | const int d7 = 7; | ||
| - | |||
| - | LiquidCrystal lcd( RS, EN, d4, d5, d6, d7); | ||
| - | |||
| - | //Pins for start and end | ||
| - | const int startPin = 2; | ||
| - | const int endPin = 3; | ||
| - | |||
| - | //Buzzer | ||
| - | const int buzzer = 11; | ||
| - | int start, end_; | ||
| - | |||
| - | //Number of contacts | ||
| - | int contacts = 0; | ||
| - | |||
| - | int x = 100; | ||
| - | |||
| - | void setup(void) | ||
| - | { | ||
| - | Serial.begin(9600); | ||
| - | lcd.begin(16,2); | ||
| - | lcd.clear(); | ||
| - | pinMode(buzzer, OUTPUT); | ||
| - | pinMode(startPin, INPUT_PULLUP); | ||
| - | pinMode(endPin, INPUT_PULLUP); | ||
| - | lcd.setCursor(0,0); | ||
| - | lcd.print("Contacts:"); | ||
| - | } | ||
| - | void loop(void) | ||
| - | { | ||
| - | lcd.setCursor(9,0); | ||
| - | lcd.print(contacts); | ||
| - | start = digitalRead(startPin); | ||
| - | end_= digitalRead(endPin); | ||
| - | //Check for loose | ||
| - | if (contacts >= 10) { | ||
| - | lcd.setCursor(0,6); | ||
| - | lcd.print("Game Over"); | ||
| - | x = analogRead (0); | ||
| - | delay(500); | ||
| - | tone(buzzer, 500, 200); | ||
| - | delay(200); | ||
| - | tone(buzzer, 1200, 200); | ||
| - | delay(200); | ||
| - | tone(buzzer, 300, 200); | ||
| - | delay(200); | ||
| - | tone(buzzer, 1000, 200); | ||
| - | delay(200); | ||
| - | tone(buzzer, 400, 200); | ||
| - | delay(200); | ||
| - | tone(buzzer, 1100, 200); | ||
| - | delay(1000); | ||
| - | if (x < 60) { | ||
| - | lcd.setCursor(0,6); | ||
| - | lcd.print(" "); | ||
| - | lcd.setCursor(9,0); | ||
| - | lcd.print(" "); | ||
| - | contacts = 0; | ||
| - | x = 100; | ||
| - | } | ||
| - | } | ||
| - | //Check for contact | ||
| - | if (start == LOW and end_ == LOW) { | ||
| - | if (contacts < 10) { | ||
| - | tone(buzzer,1000); | ||
| - | delay(300); | ||
| - | noTone(buzzer); | ||
| - | contacts++; | ||
| - | } | ||
| - | } | ||
| - | | ||
| - | //Check for finish | ||
| - | if (start == HIGH and end_ == LOW) { | ||
| - | if (contacts < 10) { | ||
| - | lcd.setCursor(0,6); | ||
| - | lcd.print("You WIN the Game"); | ||
| - | tone(buzzer,500,200); | ||
| - | delay(200); | ||
| - | tone(buzzer,500,200); | ||
| - | delay(200); | ||
| - | tone(buzzer,500,200); | ||
| - | delay(200); | ||
| - | tone(buzzer,800,150); | ||
| - | delay(150); | ||
| - | tone(buzzer,500,500); | ||
| - | delay(500); | ||
| - | tone(buzzer,600,1000); | ||
| - | delay(10000); | ||
| - | lcd.setCursor(0,6); | ||
| - | lcd.print(" "); | ||
| - | lcd.setCursor(9,0); | ||
| - | lcd.print(" "); | ||
| - | contacts = 0; | ||
| - | } | ||
| - | } | ||
| - | } </code> | ||
| - | ===== Rezultate Obținute ===== | ||
| {{:pm:prj2021:apredescu:1pm.jpg?350x200 |}} | {{:pm:prj2021:apredescu:1pm.jpg?350x200 |}} | ||
| {{:pm:prj2021:apredescu:2pm.jpg?350x200 |}} | {{:pm:prj2021:apredescu:2pm.jpg?350x200 |}} | ||
| Line 161: | Line 59: | ||
| {{ :pm:prj2021:apredescu:5pm.jpg?600x300 |}} | {{ :pm:prj2021:apredescu:5pm.jpg?600x300 |}} | ||
| - | DEMO: https://www.youtube.com/watch?v=j_EWUsdxCZM | ||
| ===== Concluzii ===== | ===== Concluzii ===== | ||
| + | Consider ca a fost un proiect foarte interesant, din care am avut multe de invatat, atat pe partea de hardware cat si pe cea de software si rezultatul este unul satisfacator. | ||
| ===== Download ===== | ===== Download ===== | ||
| Documentația în format <html><a class="media mediafile mf_pdf" href="?do=export_pdf">PDF</a></html> | Documentația în format <html><a class="media mediafile mf_pdf" href="?do=export_pdf">PDF</a></html> | ||
| + | |||
| + | Codul sursa {{ | ||
| + | :pm:prj2021:apredescu:wirebuzzgame.zip|}} | ||
| ===== Jurnal ===== | ===== Jurnal ===== | ||
| * 02.05.2021 - Introducere,lista piese | * 02.05.2021 - Introducere,lista piese | ||
| Line 175: | Line 76: | ||
| ===== Bibliografie/Resurse ===== | ===== Bibliografie/Resurse ===== | ||
| * https://create.arduino.cc/projecthub/electropeak/using-1602-lcd-keypad-shield-w-arduino-w-examples-e02d95 | * https://create.arduino.cc/projecthub/electropeak/using-1602-lcd-keypad-shield-w-arduino-w-examples-e02d95 | ||
| + | * https://create.arduino.cc/projecthub/SURYATEJA/use-a-buzzer-module-piezo-speaker-using-arduino-uno-89df45 | ||
| + | * https://circuitdigest.com/microcontroller-proejcts/arduino-buzz-wire-game | ||