On the mobile app, the devices show a “tile” (the top level interface that shows all devices). I would like to choose the LED color of a virtual pin.
Could someone explain to me the new concept of color in Blynk 2.0 in the context of tiles. The data streams required are a “color” which appears to require a string (it doesn’t appear to accept a hex code as a string - can someone give the specs?); a “button” (this appears to be an on/off button, I presume I can put in a dummy virtual pin if I don’t want to use it); and a “brightness” (is that 0-1 or 0-255 – can someone clarify?).
If this is all explained somewhere with an example, I would appreciate a link. I haven’t looked through the doc and the forum and haven’t seen it. A bit puzzling as I would think this is a common question, so apologies for taking bandwidth if this has been answered many times before.
What format have you used for the string?
Have you tried
Normally it depends on the min/max value for the datastream you are using.
If you define this as 0/1 then it will be on/off with no intermediate brightness levels.
If you define 0/255 then 255 will be max brightness, 128 half brightness etc.
If you went for 0/100000 then 50000 would be half brightness etc.
Thank you, that’s helpful. Yes, I use a hex code. V15 is assigned to the color datastream:
#define I_BLUE “#0000CD”
#define tileColorColor V15
And, yes, I selected 1 as the default value for brightness, and that ping has a range from 0-1 - maybe that range needs to be larger. If this is supposed to work, I can do some more troubleshooting.
Have you tried Blynk.setProperty() instead?
After some testing, I’ve learned:
- Blynk.virtualWrite does indeed set the value of the virtual PIN.
- Blynk.setProperty(V1,“color”,"#abcdef") sets the color of the value when displayed
- The “brightness” is a lever that shows how “full” the icon is. Presumably the idea is that one controls a dimmed light switch and it shows how bright it is. Poor choice of label.
- I get to show color #fefaec when the “brightness” is anything higher than 0, and when the button is set to “0”. Except that nowhere do I specify this specific color. I’ve tried many variations, from hex codes to plain English colors, there’s no change in the color.
At this stage, I think this is a bug, @pavel.
To get around this, I’m using the “3 label” tile to display information as that one works as expected.
Is it the colour assigned to the datastream in the template setup…
interesting idea, but, no, those colors are yet different.
The documentation for the Color tile is still in the pipeline (we know, we know…)
The Color datastream expects an array of at least 3 values (red, green, blue) - similar to zeRGBa in advanced mode. RGB values are in 0-255 range. Then there are also optional white and animation modes (true/false) and additional multiple colors with same rgb pattern. But simple Blynk.virtualWrite(pin, red, green, blue) should work.
This tile was designed to work with RGB Light Control widget.