In my project I want that when the virtual pin V0 is just pressed and released it should perform some action and if the same V0 pin is held for few seconds it should perform some other defined action.
Any idea how to do this…
Thanks
I think I’d use the BLYNK_WRITE(vPin) hanler to set a global variable to the incoming switch value obtained by the param.asInt() command
I’d then have a timer (maybe with a frequency set to 500ms) that calls a function which checks of this global variable is == 1 (button pressed). If it is then it adds one to a counter, and if that counter reaches your target value (lets say that would be 5, meaning the button had to be passed for 2.5 seconds) then you perform your “long press” action.
If the global variable == 0 (button not pressed) the you reset your counter to 0.
Pete.
It would be very helpful if you can provide the code if possible
Thanks
The BLYNK_WRITE(vPin) handler only execute when there is change in the value of vPin, isn’t it??
I’m not going to write your sketch for you. You asked for ideas and I’ve given you one, it’s up to you to implement it.
Correct, Which is why I suggested that you…
Pete.
I understand
Let me try to implement this