# 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.

• Are you really using the NodeMCU in Lua? Or are you using it with the Arduino IDE? – jDAQ Sep 9 '19 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 '19 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 '19 at 5:58
• You still don't need an interrupt – Chris Stratton Sep 9 '19 at 6:00

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