2 Bit Adder Led Game

by 651962 in Circuits > Arduino

727 Views, 1 Favorites, 0 Comments

2 Bit Adder Led Game

Finished product.jpg

This is a led arduino game that uses a 2 bit adder. The green led's at the bottom display a sequence. Using the dip switch, you have to set the red led's to the specific binary sequence required to match them to the sequence of the green led's. If you enter the correct binary sequence and the red led's display the same sequence as the green ones, the seven segment display will show a 1, if not, it will show a zero.

Supplies

Set Up Your Logic Gates,DIP Switch and Power and Ground Connections

Step 1.jpg

First connect your breadboard's power and ground to the Arduino. Next, place your logic gates in the order of the XOR, AND, and OR gate from left to right. Then connect the logic gates to power and ground. After that, place your DIP switch on the breadboard and connect all 4 inputs to power. The last part in this step is just using wires to connect the top ground and power to the bottom.

Connect the Outputs of the Switch to the XOR Gate

Step 2.jpg

Connect the output of the first switch to input 4A of the XOR gate. Connect the second wire between the output of the second switch and input 4B on the XOR gate. Next, place a wire from the output of the third switch and input 3A of the XOR gate. Lastly for this step, add a wire connecting the fourth switch's output to 3B of the XOR gate.

Connect the Outputs of the Switch to the AND Gate

Step 3.jpg

Connect the output of the first switch to input 4A on the AND gate. Then connect the input of the second switch to input 4B of the AND gate. After that connect the input of the third switch down to input 1A of the AND gate. Lastly place a wire between input 1B of the AND gate and the fourth switch's output

Place the First 3 LED's on the Breadboard

Step 4.jpg

In this step we're placing the 3 LED's that the DIP switch will control. Just place three LED's on the breadboard and connect the cathode of each LED to ground through a 330Ω resistor.

Add the Connecting Wires Between Gates

Step 5.jpg

Connect the first wire between input 1A of the XOR gate and output 4 of the AND gate. Connect the next wire from output 3 of the XOR gate to input 1B of the same gate. Connect the final wire from output 3 of the XOR gate to input 3B of the AND gate.

Make the Remaining Connections Between Gates

Step 6.jpg

In this step we're going to add 3 more wires connecting the gates to each other. The first one will be between input 4A and input 3A of the AND gate. The second one will be from output 3 of the AND gate to input 2A of the OR gate. The last one is from output 1 of the AND gate to input 2B of the OR gate.

Connecting the Outputs to the LED's

Step 7.jpg

Output 4 of the XOR gate will connect all the way to the anode of the LED on the right. Next, output 1, also from the XOR gate, will connect to the LED in the middle. Lastly, the LED on the left connects to output 2 of the OR gate.

Connect the LED's to Arduino Pins

Step 8.jpg

This is the step where we connect the LED's to the Arduino pins. Insert the individual wires into the same column that the logic gate outputs are connected to.

Place the Remaining LED's Onto the Breadboard

Step 9.jpg

Do the same here as we did for step 4. Place the LED's onto the breadboard and connect them to ground using resistors.

Place the Seven-segment Display

Step 10.jpg

This is the step where we place the seven-segment display onto the breadboard. Once placed, connect the common pins on either side of the component to power using 330Ω resistors.

Connect the Top of the Seven-segment Display to the Arduino Pins

Step 11.jpg

Connect individual wires from the g, f, a, and b pins on the display to Arduino pins.

Connect the Remaining Seven-segment Display Pins to the Arduino

Step 12.jpg

Connect the c, d and e pins of the display to Arduino pins.

Connect LED's From Step 9 to Arduino

Step 13.jpg

Finally the last step is connecting the LED's to the Arduino. Connect wires between the anodes of the LED's and a pin on the Arduino.

Time to Code!

Make sure each pin corresponds with the correct component. Here is an Arduino file to the code.