BLYNK
HOME       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

Working on interrupts with blynk

I want to update the state of the button in the blynk app whenever an interrupt is detected at a certain pin on my esp32. The problem is that the esp crashes when it encounters the blynk statement Blynk.virtualWrite(V3, Relay_State_alexa); in the ISR. Is there any way around it? Can i update the value of my button in the blynk app within the ISR? The ISR code is below and tried the part which i have commented as well. Please help!

  Serial.println("RF DETECTED!!!");
  Relay_State_alexa = !Relay_State_alexa;
  digitalWrite(RELAY_PIN_Alexa, Relay_State_alexa);
  /*noInterrupts();
  Blynk.virtualWrite(V3, Relay_State_alexa);
  interrupts();*/
  Blynk.virtualWrite(V3, Relay_State_alexa);  ------- crashes here
  digitalWrite(LED_PIN, Relay_State_alexa);
}```

@hussie910 please edit your post and add triple backticks at the beginning and end of your code so that it displays correctly.
Triple backticks look like this:
```

Also, snippets of code are of little use, as a key issue in this case will be how you declared your variables, and made your pinMode statements.

Pete.

All the variables are declared globally and declared the pin in setup as
pinMode(RELAY_PIN_Alexa, OUTPUT); @PeteKnight

And Relay_State_alexa is holding the state of the pin Relay_PIN_alexa

`Guru Meditation Error: Core 0 panic’ed (Interrupt wdt timeout on CPU0) (IDFGH-398)
Getting this error on the serial monitor

And volatile?

Pete.

no volatile…

That could be your problem, but it’s difficult to say without seeing your full code.

Pete.