Whicht typ of data Stream to use with zeRGBa?

Hey,

I am trying to use the zeRGBa on the MobilePhone with an LED Strip. But I don’t know which typ of data stream I have to use. When I tried an Integer there where no values for param[0-2]. When I used a string and converted it with param[0-2].asInt() it only worked once and I really don’t no why…

BLYNK_WRITE(V0) {
  int r = param[0].asInt();
  int g = param[1].asInt();
  int b = param[2].asInt();
  
  // Do something with r and g and b
  Serial.print("R = ");
  Serial.print(r);
  Serial.print("; G = ");
  Serial.println(g);
  Serial.print("; B = ");
  Serial.println(b);
}

Thats my Blink Write Code.

Like I said. No matter what kind of datastream I used there where never a output in the Serial monitor

@EinmalEins please edit your post, using the pencil icon at the bottom, and add triple backticks at the beginning and end of your code so that it displays correctly.
Triple backticks look like this:
```

Pete.

Have you read the documentation?..

Simple Mode:
Analog: Input, Input Pull Up, Input Pull Down , Output ;
Digital*: Input, Input Pull Up, Input Pull Down, Output* ;
Virtual: Integer, Double ;
Advanced Mode:
Virtual: String

If you use a String data type then you need to use param.asSting() or param[0-2].asSting() and then convert the values to integers,

Pete.

1 Like

Ok I did it like you said.

Now it looks like:

BLYNK_WRITE(V0){
  String r = param[0].asString();
  String g = param[1].asString();
  String b = param[2].asString();
  Serial.println(r);
  Serial.println(g);
  Serial.println(b);
  int red = r.toInt();
  int green = g.toInt();
  int blue = b.toInt();
  Serial.println(red);
  Serial.println(green);
  Serial.println(blue);
}

but the serial monitor is still not printing anything from these values.. 

The NodeMCU is connected and other Blynke Write funktions are working just fine..

greets J

How is your datastream and widget configured?

Pete.

Actually I think there is a problem with the zeRGBa widget. When I use the Joystick widget I can read the data with y = param[1].asInt. It works like it should with the zeRGBa…

Interestingly, in the iOS app you can’t even choose a datastream with a String data type when the zeRGBa widget is set top “Merge” (which according to the documentation should be called “Advanced mode”).

@Eugene @BlynkAndroidDev it looks like the zeRGBa widget needs some work, assuming that it’s going to be retained going forward.

Pete.

2 Likes