BLYNK
BLYNK.IO       📲 GETTING STARTED       📗 DOCS       👉 SKETCH BUILDER

Blynk virtual button

Hello, I put a virtual button on the blynk app and I wanted every time it was pressed to clear the message from the display (V1), but I have no idea how to do it.

//============================Configuracoes biblioteca Blynk
#define BLYNK_PRINT Serial

#include <SoftwareSerial.h>
SoftwareSerial SwSerial(10, 11); // RX, TX

#include <BlynkSimpleSerialBLE.h>
SoftwareSerial SerialBLE(10, 11);



//==============================Token de autorizacao
char auth[] = "1234";
BlynkTimer timer;



int vs = 9; //  sensor de vibração / vibration sensor
int aviso;
int latchFlag = 0;  // in pre-setup



void setup(){
  pinMode(vs, INPUT); 
  Serial.begin(9600);
  SerialBLE.begin(9600);
  Blynk.begin(SerialBLE, auth);

}

void loop(){
  long measurment = vibration();
  delay(50);
  Serial.println(measurment);
  if (measurment > 26000  && latchFlag == 0){  
 Blynk.virtualWrite(V1, "alerta!!!!");
 timer.setTimeout(10000L, []() {  
   latchFlag = 0;  
   Blynk.virtualWrite(V1, ""); 
 });  
}
Blynk.virtualWrite(V0, measurment);
  Blynk.run();
  timer.run(); 
}

long vibration(){
  long measurement=pulseIn (vs, HIGH); 
  return measurement;
}

A post was merged into an existing topic: Problems with the hc-05 together with the SW-420