Fuzzyzilla:
But sadly, this does not work as intended (the fields r, g, and b are not public).
struct Color{
union{
struct{
byte r : 5, g : 6, b : 5;
};
uint16_t color;
};
};
static Color c1;
void setup( void )
{
c1.color = 0;
c1.r = 13;
c1.g = 13;
c1.b = 13;
}
void loop( void ) { }
Sketch uses 456 bytes (1%) of program storage space. Maximum is 32256 bytes.
Global variables use 11 bytes (0%) of dynamic memory, leaving 2037 bytes for local variables. Maximum is 2048 bytes.
They are public.
How do I do this correctly?