Virtual pin = only Zero

I cant Serial.println(V0); a Virtual pin from the Blynk App.
I have a slider from 0 to 255 in the App
in the serial monitor it shows only a zero!

Thanks for Support!

BLYNK_WRITE(V6){
Serial.println(V0);
}

Virtual pins are specifically for use in Blynk functions… if you want to insert a virtual pin value into a variable, you first need to use something like this for a button, slider or other input widget…

int value;  // Globally declare variable... in this case as integer

BLYNK_WRITE(V0)  // Run this function when widget V0 is processed
{   
  value = param.asInt();  // Get value as integer... use other param.asX() options for float or string
  Serial.println(value);  // Print the content of the variable 'value'
}

Reading the Documentation is highly recommended :stuck_out_tongue_winking_eye:

http://docs.blynk.cc/#blynk-firmware-virtual-pins-control

http://docs.blynk.cc/#blynk-firmware-blynktimer-blynk_writevpin

1 Like

Thanks a lot it works fine!
Can i make more than one value?

int r;
int g;
int b;
BLYNK_WRITE(V0){
r = param[0].asInt();
g = param[1].asInt();
b = param[2].asInt();
Serial.println(r);
Serial.println(g);
Serial.println(b);
strip.Color(r, g, b);
}

#BlynkCommunityonTop

Is this for the zeRGBa Widget?

Yes

Read the documentation on this widget (link in my last post). You can get the values as you have shown, provided it is set to merge.

Ok Thanks