Monthly Members’ Competition
Competition Date: 10 to 16 Aug 2020
Tug Of War
LCD RGB Backlight
Button at Port D2
Button at Port D3
Create a game of Tug-of-War for 2 players.
Player 2 will use button at D2 and Player 2 will use button at D3
The LCD will display “Ready” for 3 seconds and start the game.
Each player will try to press as quickly as possible to to win the game.
The LCD will display a counter starting at 0.
The rules are as follows:
– If only button D2 is detected, the counter will decrease by 1
– If only button D3 is detected, the counter will increase by 1
– If both buttons are pressed together, there is no change in the counter
– The counter will not count if any player holds on to a button without releasing-
The LCD will display the counter value at 0.1 second interval
– Player 1 will win when the counter reaches -5
– Player 2 will win when the counter reaches +5
– Display the winner when a player wins and end the game
Create the program as described above
Instead of displaying the value of the counter, display “100000*000002”
The * will move towards 1 as player 1 scores a point and towards 2 if player 2 scores a point
The game ends when it reaches a player, that is, “1*00000000002” or “10000000000*2”.