Group:1222B
Mediu de dezvoltare: Arduino IDE, TinkerCAD
The LiquidCrystal_I2C library is included, which allows the Arduino to communicate with the LCD display using the I2C protocol.
The route's beginning (start) is linked to pin 8, while the route's finish/diode (end) is attached to pin 9.The wire with which the route is traveled is connected to GND. The buzzer is connected to pin 13.
The variable “contacts” is used to keep track of the number of contacts between the wire and the route.
Pins 8 (start) and 9 (end) are both in the HIGH state at the start. When both pins go LOW, it implies that the wire has come into contact with the wire's path. The number of contacts is recorded in this scenario, and a sound is played. The current round's number of touches is always displayed on the LCD and in the Serial Monitor.
If the wire touches the route 10 times during a round, the game is over and the round is lost. The buzzer emits a sound, and the message “GAME OVER” is shown on the LCD and in the Serial Monitor.
If pin 9 (end) goes to the LOW state while pin 8 (start) stays HIGH, the wire has come into contact with the bottom of the diode and the round is over. A separate sound is played, and the phrase “You Win The Game” is shown on the LCD and in the Serial Monitor.
CODE: buzzwire.rar