RGB LED Game Shield for Arduino

Introduction: RGB LED Game Shield for Arduino

I was wondering why there aren't a lot of games made by the arduino, I mean I found a page of them, but it wasn't tht many. So I decided I should try to make one of my own!

To play this game, you have to match the random color displayed by one of the rgb leds by using 3 sliding potentiometers. Then, you press a button and you are told whether you were right or not. There are 2 levels, easy and hard, and a reset button so you can go to a new color after you win.

That's the main basis of my project, and I hope you enjoy seeing how I made it.

Step 2: The Parts

For this you can either use 3 green leds and 3 red leds which are used to display if you won the game or lost it, but you can also do what I did and use 3 red/green leds.

The pc board

Make sure the pc board is large enough to cover the entire arduino, as some pieces are too small and will not fit all the parts or pins on the arduino.

Resistors

I used 100 ohms on the blue and green of the rgb leds and 150 ohm on the red but that can change depending on your leds. I used 150 ohm on my red/green leds but thaat can change for yours too. The reset button has one 100 ohm resistor and the "checking button" has a 10k and a 100 ohm resistor.

Step 3: Bend the Headers

the make the headers work for this shield, use pliers and push the smaller part down so the longer part gets longer. Now cut two of the headers into blocks of 6 and the other 2 headers into blocks of 8.

The arduino does not have all .1" spacing, so we have to accomodate for that. Take one of the 8-blocks and bend all the pinsto one way about 30 degrees. Now,grab the pins a little higher with the pliers and bend them back to normal. This should offset them just enough to fit the arduino.

Step 5: The Code

The code for this project is pretty simple. The first part is for defing everything, the second for creating a random color, and the third for using the potentiometers and giving the pushbutton and leds commands.Here it is:

/*Code for rgb led game shield. By Ikestarm17. Special thanks to Ladyada forall the great products, mbeckler for his informational site, marklar, grumpy_mike,and AWOL on the Arduino forums.*/

int greenled1 = 13;int greenled2 = 8;int greenled3 = 4;

int redled1 = 19; int redled2 = 7;int redled3 = 12; // leds that show if you were right or not

int redguess;int greenguess;int blueguess; // variables to store the values of your led to compare to the random ones

/* This following part before "void setup()" *is all about making the rgb led *a "good" random color, not just a whited out one. *I don't know much about this part, *because I only changed one little part, *Marklar from the arduino forums created it */

Step 6: Final Thoughts

I think this project works pretty well and is entertaining for long car rides and other things. I know my soldering on the back was not very good but my soldering iron was not working right and I am still a beginner at electronics. This was my first arduino project and I hope you enjoyed it. Thanks for reading!

Comments

I noticed a problem with the sketch!! If its not already fixed in your sketch/code, The #include WProgram.h is now Arduino.h in the newer versions of Arduino IDE. Thanks for the share, this is great, gonna give it a go!