Segmented Switch how it works

Yes, this is for virtual pins… and the base code is the same as reading the vPin on every other Widget.

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

And with this segmented switch, you can go up to 5 options, so Switch Case code might work best.

https://www.arduino.cc/reference/en/language/structure/control-structure/switchcase/

BLYNK_WRITE(vPin) {
  switch (param.asInt())
  {
    case 1: { // Item 1
        // Do something
        break;
      }
    case 2: { // Item 2
        // Do something
        break;
      }
    case 3: { // Item 3
        // Do something
        break;
      }
    case 4: { // Item 4
        // Do something
        break;
      }
    case 5: { // Item 5
        // Do something
        break;
      }
    }
}
4 Likes