In this instructable we will show you how to build a four in a row game using Arduino Uno. It's 7x6 LED Matrix using 3x Shift Registers 74HC595 and 42xBi-Color LED (Red/Green), common anode.
Each player is either red or green LEDs. Each column have a button, when that button is pressed the LED furthest down available in that column will be lighted. Each player can only light one LED each round. When player 1 have done a move it's players 2 turn and so forth. We have also installed a regret button that remove the last LED lighted, but each player can only do this 1 time each game.
It's a fun project and it's a 1vs1 game so it's the perfect game to play with a friend!
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Materials
42 x Bi-Color LEDS, common anode.
3 x Shift Registers (74HC595)
15 x Push-Buttons (one for Regret-button)
4 x Solderless breadboard
Step 2: Circuit Schematic
Here are some serious wiring to be done.
Step 3: Code
There are smarter ways to do this code but we are beginners and took the easy way.
With this code it doesn't matter who begins. Each player can regret one time each game. Nothing happends when you get four in a row, the player needs to see that himself. You have won the game when you get four LEDs in a row either across, vertical or catecorned. When someone has won you just press the reset button on the Arduino and you can play again.