[SOLVED] Virtual button pressed for X seconds

I have 3 min before I am leaving work for the long weekend…

Here it goes:

BLYNK_WRITE(PIN){
  if(param.asInt()){
    // button pressed
    newTimer = timer.setTimeout(1000,newTimerCallback)
  } else {
    timer.disable(newTimer);
  }
}


void newTimerCallback(){
  // perform your "held" button action. 
}

There may be another way to do it but this works for me.
You can set the timeout longer/shorter… i just use 1s.

2 Likes