Blynk Step Widget resetting to 0 and sending 255 as default value

Hi, Blynk support

I am using iPhone 11 with IOS version 13.5. I have made an app to control led connected to nRF52840 Arduino via BLE connection. I am using the blynk step widget to control LED. The step widget seems to have few issues

  1. when I stop the app and play again the step widget resets to 0 or -1.
  2. I have configured widget to increment 1 step but the widget sends value as 255 for an increment and 1 for decrement.

I am attaching the code snippet I used to read the step widget and workaround for the problem statement 2 but I am not able to tackle problem statement 1.


// To read a virtual pin in Blynk app:
BLYNK_WRITE(V7)
{

  // V7 is sine wave cycles
  V7_value = param.asInt();
  if ((V7_value == 1) && (sine_cycles < 10))
  {
    sine_cycles++;
  }
  else if ((V7_value == 255) && (sine_cycles > 1))
  {
    sine_cycles--;
  }


  //used for testing purpose
#ifdef DEBUG
  Serial.println("V7");
  Serial.println(sine_cycles);
#endif
}

Please help me to resolve this issue.

Best regards,
Jesse

@jesse 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.

1 Like

Can you post a screenshot of your widget setup?

Pete.

Send Step option allows you to send step to hardware instead of actual value of step widget.

If you want the value then turn ‘send step’ off.

Pete.