Hello everyone.
I have the Blynk application on IOS and I want to use the zergba widget. According to the documentation, you have to use a string datastream when you want to use the merge mode.
However, when I want to choose the datastream, I am only offered integers datastreams. I have looked in old posts and I saw that only the IOS version had this problem. I would like to know when this issue will be fixed. If not what are the other solutions to use the zergba wigdet with a led strip and the FastLED library.
The three values should be sent from the widget as a string array, but this is a bug in the iOS app as it doesn’t allow string datastream types to be selected.
In split mode, each of the parameters will be sent to a separate virtual pin instead of sending them all to the same virtual pin, so you can send the red color value to V1 for example, and use the BLYNK_WRITE() function to retrieve the value from the server. Something like this
BLYNK_WRITE(V1) // zeRGBa assigned to V1
{
// get a RED channel value
int Red = param.asInt();
Serial.println(Red);
}
Yes.
Both modes are the same. The only difference between the two modes is the way they output data. Split mode outputs a single parameter, while merge mode outputs one message consisting of an array of values.
You can, but there are a few drawbacks.
It now requires 3 datastreams rather than 1, and this might be an issue if you are approaching the datastream limit for your plan.
Also, if you previously had one BLYNK_WRITE(vPin) function to handle all of the RGB commands you will now need three - one each for Red, Green and Blue.
You’ll probably need to have global rather than local variables for R, G & B and put your FastLED code in a function that is called whenever one of the three BLYNK_WRITE(vPin) functions for your ZeRGBa widget is triggered.
I would have expected this to be in a function called by each of your BLYNK_WRITE(vPin) functions, and you’ll probably need a BLYNK_CONNECTED() function with Blynk.syncVirtual(vPin) commands for each of your virtual pins.
CRGB leds[NUM_LEDS];
BLYNK_WRITE(V1)
{
int red = param.asInt();
}
BLYNK_WRITE(V2)
{
int green = param.asInt();
}
BLYNK_WRITE(V3)
{
int blue = param.asInt();
}
BLYNK_CONNECTED()
{
int RED = Blynk.syncVirtual(V1);
int GREEN = Blynk.syncVirtual(V2);
int BLUE = Blynk.syncVirtual(V3);
fill_solid(leds, NUM_LEDS, CRGB(RED, GREEN, BLUE));
FastLED.show();
}
Placing “int” in front of a variable name declares it. This should be done once only, near the top of the code if you want global variables (which you do).
This…
Is the incorrect syntax, it’s simply…
Blynk.syncVirtual(V1);
And you still haven’t put your FastLED code in a function and called it from each of your BLYNK_WRITE(vPin) functions.