I can't print the value of a CRGB variable through direct access. I'm not sure why but it prints out 0.
CRGB color[6];
color[0] = (170, 100, 100);
....
Serial.println(color[0].red);
What could cause it to not print or not get set to 170?
I can't print the value of a CRGB variable through direct access. I'm not sure why but it prints out 0.
CRGB color[6];
color[0] = (170, 100, 100);
....
Serial.println(color[0].red);
What could cause it to not print or not get set to 170?
CRGB color[6];
color[0] = CRGB(170, 100, 100);
// or
color[0] = {170, 100, 100};
....
Serial.println(color[0].red);
Pieter
If you try to assign a CRGB a value with a brace-enclosed initializer list it can't determine if you mean that to be an RGB value or HSV (Hue, Saturation, Value) value.
/Users/john/Documents/Arduino/sketch_dec01a/sketch_dec01a.ino: In function 'void setup()':
sketch_dec01a:21:28: error: ambiguous overload for 'operator=' (operand types are 'CRGB' and '<brace-enclosed initializer list>')
color[0] = {170, 100, 100};
^
In file included from /Users/john/Documents/Arduino/libraries/FastLED/controller.h:9:0,
from /Users/john/Documents/Arduino/libraries/FastLED/FastLED.h:47,
from /Users/john/Documents/Arduino/sketch_dec01a/sketch_dec01a.ino:5:
/Users/john/Documents/Arduino/libraries/FastLED/pixeltypes.h:167:15: note: candidate: CRGB& CRGB::operator=(const CRGB&)
inline CRGB& operator= (const CRGB& rhs) __attribute__((always_inline))
^~~~~~~~
/Users/john/Documents/Arduino/libraries/FastLED/pixeltypes.h:208:15: note: candidate: CRGB& CRGB::operator=(const CHSV&)
inline CRGB& operator= (const CHSV& rhs) __attribute__((always_inline))
^~~~~~~~
exit status 1
ambiguous overload for 'operator=' (operand types are 'CRGB' and '<brace-enclosed initializer list>')