Array not working as intended?

Hi AppleAssasin,

You can use one resistor for each rgb led for the moment while you test and fix your current code/wiring problem. One resistor will work ok if you only only want either red, green or blue (although they may not be equal brightness). When you come to try mixing other colours like yellow, cyan, magenta or white that you will see why Mike is right and have to use 3 resistors per rgb led (and the resistors on the reds will probably need to be a little higher than those on the greens & blues). But cross that bridge when you come to it.

I can see a problem with your sketch that may explain why "r2" does not work. When you put "redGroup [val [1]]" the problem is that the character "2" does not have the value 2. Its value is the ASCII code for the character "2". C/C++ will not do this conversion for you implicity like other languages do. You need to do it yourself. Simplest way is to subtract the ASCII code for "0", for example "redGroup [val [1]-"0"]".

But that doesn't explain why "ra" does not work. Have you tested your wiring? Take each jumper lead, in turn, out of its Arduino digital output and touch it to +5V to check that a led lights up.

Paul