Constants question

Is it possible to define each color with its RGB equivalent as a constant. I have tried something like the code below but it returns 0 instead of 127,0,0 as I would like. I would like to do this to make my code more readable. Any guidance? Thanks

const char red= '127,0,0'; //Red

setSpoke(0,strip.Color(red)); //red
Serial.println(red);

I think you should read up on the use of arrays, as that is probably how you could do what you are looking for.

const char colorRed[] = {127, 0, 0};
const char colorGrn[] = {0, 127, 0};
const char colorBlu[] =  {0, 0, 127};

Lefty

But, why would you use char variables or arrays to hold numbers? byte or uint8_t seem more logical to me.

Yes, I know it makes no difference to the compiler, as long as you keep in mind the range of values that can be stored in a char (which is not the same range as can be stored in a byte. even though they are the same size).

It makes a difference to humans trying to follow the code, though.

I think you want something like that?

http://codepad.org/veBBXu6k