Can I use an Virtual pin to trigger an interrupt?

Hello,
I’m trying to make an automatic room light control system using bidirectional visitor counter on NodeMCU. Can I use a virtul pin to trigger an interrupt, so that i can some times switch on the lights in room by pressing the button on Blynk app ? If yes, please guied me about the code to be used.

Since you don’t need a hardware interrupt to read from a button push on the App, I am unsure if you are understanding what you need?

A hardware interrupt is solely a thing on the device side… used to forcibly detect a signal on physical pin.

Virtual pins are a way of transmitting control and data between the App and Device. For example, when pushing a button on the App set to V0, then you can do whatever you want on the device end within the function that gets called by the virtual pin V0… and since that happens whenever the button is pressed it is sorta like a software interrupt.

Here is the “code” that you need… along with all the other documentation and examples (links at the top right of this page)

http://docs.blynk.cc/#blynk-firmware-virtual-pins-control-blynk_writevpin

1 Like

I’m a newbie in the world of programming, I’m sorry if my question was wrong/confusing in any way.

Basically what I need is something like a two way switch.
1.Lights will be on when a person count in room is >0 (this part is working fine)
2. Now I want to switch off the lights when ‘person in room’ (or) switch on the lights when ‘no person in room’ by pressing a button on Blynk app

I’m struck at the 2nd part. I tried writing various codes without any positive results.

We don’t teach programming or help program your projects. We help you with specific question about Blynk commands layouts, etc, as you learn how to use Blynk.

I recommend you start with the Help Center documentation and the examples in the Sketch builder. All these links are at the upper right of this page… scroll up until you see them.