This is probably a dumb way to do this but it seemed like a

This is probably a dumb way to do this but it seemed like a simple/easy way.

I am trying to check if the color of led[i] == someColor then change the color but the compiler doesn’t like the way I’m trying to get it to work. Does anyone know of a way to get something like the example below to work? Hopefully G+ doesn’t butcher the code too bad, I don’t think this tiny amount of code warrants a gist.

if (leds[i] == CRGB::Black) {
leds[i] = CRGB::Green;
} else {
leds[i] = CRGB::Black;
}

i dont know for certain, but I think the only way to get the value is by checking the hex, not the struct name:

if (leds[i]==0x000000){ …

@Christopher_Kirkman1 Well shoot, that’s what I was trying but it doesn’t work. I only used the struct name to make the example easier to understand. The error that the compiler throws is “ambiguous overload for ‘operator==’ (operand types are ‘CRGB’ and ‘int’)”

The error makes sense and I understand why it doesn’t work. Just hoping someone knows a way to do what I am wanting.

how about the long way, i.e:

leds[i].r==0 && leds[i].g==0 && leds[i].b==0

?

[EDIT] G+ wacked formatting. See here:
https://pastebin.com/huBD8Lrd

if (leds[i] == (CRGB)(CRGB::Black))

That compiles and i think does what you want.

@Gibbedy_G Thank you! I tried this way first since it seemed simpler than the other solutions and it worked great. Thank you to the others that also chimed in. It’s always interesting to see how other people would solve the same problem.