Hi,
I'm trying to control some RBG leds with Z-uno. I used the ZUNO_SWITCH_COLOR() macro to set-up the channel as in the Reference page. In the controller (Razberry) the color switch is registered properly and I can select a color there. But when I change the RGB color, the Z-Uno setter function is called only once with the flag for the red color (with a value that should be assigned to the blue component). I was expecting this setter function to be called 3 times, one for each of the colors. Should this be working differently?
Color Switch in Z-uno for RGB leds
Re: Color Switch in Z-uno for RGB leds
Make sure to define color components correctly.
You can have a look on our configurator:
https://z-uno.z-wave.me/shield/configur ... C&pin12=NC
You can have a look on our configurator:
https://z-uno.z-wave.me/shield/configur ... C&pin12=NC
Re: Color Switch in Z-uno for RGB leds
I don't use PWM to control the LEDs. I have WS2811 Led strips. I use this code to get the RGB values from the controller:
ZUNO_SETUP_CHANNELS(ZUNO_SWITCH_COLOR(SWITCH_COLOR_FLAGS_RED|SWITCH_COLOR_FLAGS_GREEN|SWITCH_COLOR_FLAGS_BLUE, getColor, setColor));
void setColor (byte color,byte value){
switch (color){
case SWITCH_COLOR_FLAGS_RED: Serial.println("SetColor red");
red = value;
break;
case SWITCH_COLOR_FLAGS_GREEN: Serial.println("SetColor green");
green = value;
break;
case SWITCH_COLOR_FLAGS_BLUE: Serial.println("SetColor blue");
blue = value;
}
}
byte getColor (byte color){
switch (color){
case SWITCH_COLOR_FLAGS_RED: return red;
case SWITCH_COLOR_FLAGS_GREEN: return green;
case SWITCH_COLOR_FLAGS_BLUE: return blue;
}
As you can see I added some message to the serial monitor to see what happens. The issue is, that when I change the color on the controller, the setColor function is called only once with the red component. It's not called for the blue and green.
ZUNO_SETUP_CHANNELS(ZUNO_SWITCH_COLOR(SWITCH_COLOR_FLAGS_RED|SWITCH_COLOR_FLAGS_GREEN|SWITCH_COLOR_FLAGS_BLUE, getColor, setColor));
void setColor (byte color,byte value){
switch (color){
case SWITCH_COLOR_FLAGS_RED: Serial.println("SetColor red");
red = value;
break;
case SWITCH_COLOR_FLAGS_GREEN: Serial.println("SetColor green");
green = value;
break;
case SWITCH_COLOR_FLAGS_BLUE: Serial.println("SetColor blue");
blue = value;
}
}
byte getColor (byte color){
switch (color){
case SWITCH_COLOR_FLAGS_RED: return red;
case SWITCH_COLOR_FLAGS_GREEN: return green;
case SWITCH_COLOR_FLAGS_BLUE: return blue;
}
As you can see I added some message to the serial monitor to see what happens. The issue is, that when I change the color on the controller, the setColor function is called only once with the red component. It's not called for the blue and green.
Re: Color Switch in Z-uno for RGB leds
We will check this issue. Thank you
Re: Color Switch in Z-uno for RGB leds
You mixed flags (bitmasks) and constants.
in setter/getter you need to use SWITCH_COLOR_COMPONENT_xxx instead: https://github.com/Z-Wave-Me/Z-Uno-Core ... ons.h#L481
in setter/getter you need to use SWITCH_COLOR_COMPONENT_xxx instead: https://github.com/Z-Wave-Me/Z-Uno-Core ... ons.h#L481