The first version (v1.0) of my code (code.ino) is made for a chess clock with the following design: https://www.tinkercad.com/things/izdj3lSTSRr-my-chess-clock
The second version (v2.0) of my code (revised_code.ino) is made for a different chess clock with the following design: https://www.tinkercad.com/things/9GNWRFxF56N-my-chess-clock-v20
There's an another version of the code (tm1637_implementation.ino) meant for a chess clock with TM1637 clock displays instead of the I2C displays used in the TinkerCAD version.
TLDR Features:
- Separate times for Players 1 and 2
- Increment time control
- Can store previous time and game score setting
- Ending and warning beeper
- The difference between v1.0 and v2.0 is that v2.0 has two additional displays to show Player 1 and 2 times separately
To be added in version 2.0:
- Revamp settings so that only one button has to be pressed (if trying to go fast)
- Better time handling using millis(), using delay() for now
- Add a centisecond display (extra digit to decisecond display) after this improvement
- Stop the excessive blinking of the clock displays //Need to check if this works
- Make the button functionality more responsive by changing the button to wait for input before delaying
- Set time and date clock and display time and date when chess clock not in use or only time in corner when chess clock being used
Added (difference between v1.0 and v1.1):
While starting up and setting time:
- Welcome Screen
- Game score counter, stored in EEPROM storage
- Option to use previous time settings or not when setting up (Player 1 (white) or left button for YES, Player 2 (Black) or right button for NO)
- Option to use previous game score or not is separate. If not used and new chess game is started and ended, previous game scores will be overwritten.
- Option to turn beep off (Button 1 for YES to turn beep off, Button 2 for NO to leave beep on)
- When using previous time settings, automatically skip to start game screen
- A each person has x time PER MOVE setting (causal mode)
- On the "Competitive or causal?" screen, press Button 1 for competitive mode (each player has x time for the whole game) and Button 2 for casual mode (each player has x time PER MOVE)
- Increment minutes by 5 after 15 mins, by 10 after 30, by 5 after 40, and by 10 after 50
- Increment the increment by 5 after 15 secs
During game:
- Start the timer (when the game starts) only when player 1 presses their button
- Colon blinking during game
- Hexadecimal minutes up to 12, for 120 minutes (v2.0 only)
- Show time difference on LED display (v2.0 only)
- Decisecond display under 20 secs
- Ending buzzer melody (Blaze of Glory by Bon Jovi, riff only)
- A beep every time a turn is made
- 1 minute and 10 seconds warning (using buzzer)
- Ability to reset the chess clock after timing out and also the option to play again with the same settings (just use the Reset button)
During pause:
- Ability to add or subtract time during a game while in the Pause menu (Press Button 1 while the game is paused)
- End game early using Pause menu and increment game counter accordingly (Press Button 2 while the game is paused)
- On the "Who won?" screen, press Button 1 for White and Button 2 for Black
- On the "Play again?" screen, press Button 1 to play again with the same time controls, press Button 2 to set time controls again (to change settings like the beep, use the Reset button, game scores will be saved)
How to use: This chess clock allows you to set separate times for players 1 and 2 (although you can leave the times for player 2 blank if you want to have players 1 and 2 the same). Leaving player 1's time blank will set the time control to be 10 minutes (player 2's time can be set separately or not). When starting the chess clock and setting the time controls, use the player 1 button to decrement, the player 2 button to increment, and the Set button to set that time setting. You can also set the increment time (in seconds) after setting player 1 and player 2's time. When the game is running, the Player 1 and Player 2 buttons will swap turns from black to white and vice versa, and the Set button will pause and unpause the game. There's also a Reset button (not coded, but included in both designs) that will reset the chess clock back from the start. The clock counts in centiseconds for high accuracy, but centiseconds are not displayed until last 20 seconds. After a player times out, the display will change to show who has timed out and the piezo buzzer will beep until the chess clock is reset or disconnected from power. This chess clock also can store the previous game setting and will restore those settings the next time you play (the first time you use it, though, will simply show zeros for all settings). The difference between v1.0 and v2.0 is that on v2.0, two additional 4-digit 7-segment displays will show the times for Player 1 and 2 separately, while this information is put onto one 16 X 2 LCD on v1.0.
Limits: On v1.0, there is a limit of 999 minutes and 59 seconds, while on v2.0, there is a limit of 120 minutes and 59 seconds. The increment limit (in seconds) for both versions is 60 seconds.
When multiple buttons are pressed, the player 1 button has first priority, then the player 2 button, then the Pause/Set button. (However in Pause menu, Pause/Set button has higher priorty than Player 2 button so that game isn't ended accidentally).