What you build
A scoreboard for the backyard. Enter each team's bags at the end of an inning, from the buttons on the scoreboard or from a remote at the far board, and it works out the score with cancellation scoring, the way the leagues play, until a team reaches 21.
- The scoreboard: an Arduino Uno with an eight-digit MAX7219 display on A0, A1 and A2, an active buzzer on pin 9 and five pushbuttons on pins 2 to 6: A board, A hole, B board, B hole and DONE.
- The remote: a second Uno with the same five buttons.
- The link: an nRF24L01 radio on each Uno, on the SPI pins with CE on 7 and CSN on 8, powered from 3.3 V.
The rules
Each inning both teams throw four bags. A bag in the hole is 3 points and a bag on the board is 1. At the end of the inning the two totals cancel: only the team with more scores, and only the difference. 7 against 5 is 2 points. 3 against 3 is a wash, and nobody scores. The first team at 21 or more when an inning ends wins.
The scoreboard enforces it: a fifth bag for a team is refused, and the win is only checked at the end of an inning.
How it works
Multiplexing. The MAX7219 lights its eight digits one after another, about 800 times a second, so three wires drive 64 LEDs.
Debouncing. Button contacts bounce for a few milliseconds, so a change within 30 ms of the last is ignored.
One command for every input. A button on the scoreboard and a letter from the remote (a, A, b, B or D) both call the same function, so there is only one copy of the rules.
Acknowledged packets. The nRF24L01 waits for the other radio to confirm each packet and retries if it does not, so the remote knows whether a press arrived.
Effects that never block. The fanfare and the flashing final score are stepped through with millis(), so the scoreboard keeps listening to the buttons and the radio throughout.
The course
Build a cornhole scoreboard gets there in six lessons, all on the same wiring:
- Big digits: wake the MAX7219, a lamp test, and a count to 21.
- Buttons for teams: 1 for the board, 3 for the hole, debounced, with UNDO.
- Rules in code: four bags, cancellation scoring and first to 21.
- A remote: a second Uno over the radio, with acknowledged packets.
- Win effects: a fanfare and a flashing score.
- Project: a backyard board: real innings, then build it for your yard.
Every step is checked against the running circuit, apart from the last, where you make the scoreboard your own and share it.