BLYNK
HOME       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

Program with c++

what is the instruction to read a virtual value help me !!

Haven’t you been using Blynk for over a year now?

A virtual pin is essentially a Blynk specific variable.

Look at the virtual pin reference in the >DOCs< and download from the >examples< to get a feel for how to utilise them.

Not to mention searching around this forum for the massive amounts of example code that is available.

Here is an example of reading from the zeRGBa widget (set to V0 and MERGE mode) that controls a physical RGB LED wired to digital PWM pins: (RED - 9, GREEN - 10, BLUE - 11 Using Arduino UNO for this pinout example). But also sending that value data back to three LED widgets on the app: (RED - V1, GREEN - V2, BLUE- V3).

BLYNK_WRITE(V0)  //  zeRGBa widget  - BLYNK Function that is called every time colour change is made on widget.
{
  int rrr = param[0].asInt(); // get the RED channel value.
  int ggg = param[1].asInt(); // get the GREEN channel value.
  int bbb = param[2].asInt(); // get the BLUE channel value.

  Blynk.virtualWrite(V1, rrr);  // Set RED LED widget intensity.
  analogWrite(9, rrr);  // Write to value RED RGB pin.

  Blynk.virtualWrite(V2, ggg);  // Set GrREEN LED widget  intensity.
  analogWrite(10, ggg);  // Write value to GREEN RGB pin.

  Blynk.virtualWrite(V3, bbb);  // Set BLUE LED widget intensity.
  analogWrite(11, bbb);  // Write value to BLUE RGB pin.
}
1 Like