# NodeMCU GPIO pin interrupt [closed]

When using NodeMCU, I want to toggle the state of GPIO pin, using a physical switch. When the switch is pressed, the switch state should toggle from low to high, or high to low.

I know I need to use interrupts here, however I am unable to find relevant information online. I need help with circuit to implement a switch for GPIO interrupt. What would be ideal resistor value etc.

I forgot to mention, i am using Tasmota firmware on NodeMCU.

Thanks.

## closed as unclear what you're asking by Chris Stratton, Oleg Mazurov, Finbarr, JRE, Brian CarltonSep 22 at 22:13

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

• Are you really using the NodeMCU in Lua? Or are you using it with the Arduino IDE? – jDAQ Sep 9 at 4:34
• "I know I need to use interrupts here" no, you almost certainly do not. A switch moved by a human, or even many mechanisms is quite slow in computer terms, polling is typically fine. And where debouncing is needed, polling is often best. You do, however, need a pulling resistor. Perhaps you are confusing the two very distinct concepts? – Chris Stratton Sep 9 at 5:20
• @ChrisStratton Thanks for the update, i missed to mention that i am using Tasmota as the firmware. I need a way for the user to manually override the automated switch. – Suresh Kumar Sep 9 at 5:58
• You still don't need an interrupt – Chris Stratton Sep 9 at 6:00

   gpio.trig(pin, [type [, callback_function]])