I´m working on an game project for my pre diploma (in german vordiplom). So my Problem is that i have 9 fields which are illuminated by RGB LEDS (LL-U49 RGB 1C RGB-LED http://cgi.segor.de/user-cgi-bin/sidestep2.pl?foto=1&Q=LL-U49+RGB+1&M=1) and I need for each LED 3 Pins from my arduino. To Mix the colors I also need PWM. The Main Game idea is to switch randomlyo the color of each field. I need 3 x 9 Pins = 27 to get this to work.
So is there any chance to expand the pins on the Arduino? Or some other Trick?
I hope that my english is not too bad.
Get yourself a 74HC595 chip and go through this tutorial. I've tried it myself and it's works really well for controlling lots of LED's:
hope it helps
thx for the Link. I got an max7219 (http://www.maxim-ic.com/quick_view2.cfm/qv_pk/1339) today. I think it should work also with this. If someone has allready used a max7219 please tell me or give some links ...
Thx a lot.
if you want i could send you a code example for the max7219, but the problem is with the max7219 all the LED#s have to have the same intensety/brightness, you can not set different intenseties for different LED#s, so you can not mix the colours . thats why you want use the PWM, isn't it ?
a little while ago have been taken place a quit long discussion about RGB-matrix and arduino, so check out the old treats, some people came up with some good solutions,...
Hi, yes right i need PWM because i need to mix colors. I have 9 RGB Leds which should be in different colors ...
Thx for your Post. I will try to find these old treats ... i hope i´m not running out of time or my project.
you could build your own matrix with the arduino,
you are having 3 pwm on the arduino, so use each of them for one colour, contect each color to each LED and the ground of each LED to on digitalPIn, thats it the rest is just some nice programming, ....
while i"m thinking about it you don"t need to connect the colors to the PWM, just some normal digitalOut PIn should be enough.
about the code:
put the first color to high and each LED how should light up in this color you have to set this grounds on (digitalWrite, ground of the LED, LOW) all the LED who should not light up have to be digitalWrite HIGH, ....
then turn the first color of and the secound one and again the game with the ground, ....
if you do this fast enough you will see mixed colors, nice isn"t it,...
further more, i was thinking about a nice funktion to have diffferent brightness, you could write a funktion which to the f++k 255 times (for example) so you could say if you want to have the red on 50% just turn it every second run on, and so on
i hope i could help you somehow, it is a little bit to early on a monday for me to come up with some good explanation, but i hope you got the idea,...
by the way where in berlin you are studying ?
if you have some questions you could also ask in german....
ha det bra