Yes possible, but the ESP8266 only has one core and one set of peripherals. WiFi uses time, interrupts, and even the ADC peripheral, and maybe more.

This is why anything timing-critical, or time-intensive, is a pain to get to work properly on an ESP8266. It depends one what you are trying to do, of course, and also on if you can unload what you want to a peripheral the WiFi doesn't use, or if switching off WiFi is an option during parts of your code.

Generally, for applications such as yours, I would get an ESP32 or an Arduino Nano 33 IoT or any other solution that has a core for handling WiFi, and a core for you to use without restrictions. It makes development a more pleasant experience.

If, for some reason, you are bound to using an ESP8266, you would have to be more specific about what your eventual goal is; maybe a workaround can be found.

Answer from ocrdu on Stack Exchange
🌐
Random Nerd Tutorials
randomnerdtutorials.com › home › esp8266 › esp8266 projects › esp8266 interrupts and timers using arduino ide (nodemcu)
ESP8266 Interrupts and Timers using Arduino IDE (NodeMCU) | Random Nerd Tutorials
August 6, 2019 - With interrupts, when a change is detected, an event is triggered (a function is called). As an example, we’ll detect motion using a PIR motion sensor: when motion is detected, the ESP8266 starts a timer and turns an LED on for a predefined ...
🌐
Last Minute Engineers
lastminuteengineers.com › handling-esp8266-gpio-interrupts-tutorial
Configuring & Handling ESP8266 GPIO Interrupts In Arduino IDE
January 20, 2026 - Learn to configure & handle ESP8266 GPIO Interrupts along with Attaching Interrupt, Modes, ISR with ICACHE_RAM_ATTR & Code with Explanation
🌐
ESP8266 Arduino Core
arduino-esp8266.readthedocs.io › en › latest › reference.html
Reference — ESP8266 Arduino Core documentation
Receive is interrupt-driven, but transmit polls and busy-waits. Blocking behavior is as follows: The ::write() call does not block if the number of bytes fits in the current space available in the TX FIFO. The call blocks if the TX FIFO is full and waits until there is room before writing more ...
🌐
Microcontrollers Lab
microcontrollerslab.com › home › esp8266 › esp8266 interrupts and timers arduino ide – pir motion sensor example
ESP8266 Interrupts and Timers Arduino IDE - PIR Motion Sensor Example
December 2, 2025 - By using ESP8266 interrupt, we will be able to detect changes on GPIO pins without the need to continuously poll GPIO pins. Whenever an interrupt occurs, we can execute a certain function that should execute on state change of a specific GPIO pin.
🌐
Circuits4You
circuits4you.com › 2017 › 12 › 08 › esp8266-external-interrupt-example
ESP8266 External Interrupt Example | Circuits4you.com
July 22, 2018 - Interrupt Subroutine. The ESP8266 has two different kinds of interrupts: “external”, and “pin change”. ESP8266 all pins have external interrupt except GPIO 16.
🌐
Arduino
arduino.cc › reference › en › libraries › esp8266timerinterrupt
ESP8266TimerInterrupt - Arduino Reference
October 1, 2021 - This library enables you to use Interrupt from Hardware Timers on an ESP8266-based board. These ESP8266 Hardware Timers, using Interrupt, still work even if other functions are blocking. Moreover, they are much more precise (certainly depending on clock frequency accuracy) than other software ...
Find elsewhere
🌐
GitHub
github.com › esp8266 › Arduino › blob › master › cores › esp8266 › interrupts.h
Arduino/cores/esp8266/interrupts.h at master · esp8266/Arduino
// do work outside of interrupt lock here outside its scope · //} // · namespace esp8266 · { · class InterruptLock { public: InterruptLock() { _state = xt_rsil(15); } · ~InterruptLock() { xt_wsr_ps(_state); } · uint32_t savedInterruptLevel() const { return _state & 0x0f; } ·
Author   esp8266
🌐
Daniellethurow
daniellethurow.com › blog › 2021 › 9 › 8 › interrupts-with-adafruit-feather-huzzah-esp8266
Using Interrupts on the Adafruit Feather Huzzah with ESP8266 | Duct Tape, Bubble Gum, and Solder
September 8, 2021 - Interrupts are a way to interrupt the standard flow of your program. In my particular case, I want to interrupt whatever I’m doing in my loop() function and turn on the LED when I press the button. ... The ESP8266 stops whatever is currently happening and saves the context so it can get back ...
🌐
Reddit
reddit.com › r/esp8266 › need some help with interrupts and timers
r/esp8266 on Reddit: Need some help with interrupts and timers
September 18, 2022 -

Hi guys, i've been working on this for a couple of days now and my head hurts...

I am trying to do something like this:

  1. Pin interrupt turns on LED

  2. A 100ms timer starts while the main loop keeps running

  3. When the time is up, an interrupt turns the LED off exactly after 100ms.

The impulses come at random, sometimes 2 or more in less than 1ms.

I've tried adding the turn off command inside the loop but depending on where the program is, it never turns off afterthe same amount of time.

I know that there is an option with Timer1 but i just can't get it to work...

🌐
Random Nerd Tutorials
randomnerdtutorials.com › home › project › esp8266 › micropython: interrupts with esp32 and esp8266
MicroPython: Interrupts with ESP32 and ESP8266 | Random Nerd Tutorials
July 30, 2020 - ESP32 interrupt pins: you can use all GPIOs as interrupts, except GPIO 6 to GPIO 11. ESP8266 interrupt pins: you can use all GPIOs, except GPIO 16.
🌐
techtutorialsx
techtutorialsx.wordpress.com › 2016 › 12 › 11 › esp8266-external-interrupts
ESP8266: External interrupts – techtutorialsx
March 14, 2019 - The best approach is to signal the main code, using for example a flag or a counter, to indicate that the interrupt has happened. Then, the main code should have the logic necessary to handle it. In our case, we will define a very simple handling function that detects a falling edge of the digital signal in one of the GPIOs of the ESP8266 and signals the main code to print a message to the serial port.
🌐
Blogger
lucstechblog.blogspot.com › 2019 › 02 › arduino-and-esp8266-interrupts.html
lucstechblog: Arduino and ESP8266 interrupts
However that turned out to be a bit more complicated as I thought. Interrupt An interrupt on the ESP8266, ESP32 or Arduino (any version) is about the same as an interrupt in real life.
🌐
Home
gndtovcc.home.blog › 2020 › 04 › 16 › esp8266-interrupts-and-timers-using-arduino-ide-nodemcu
ESP8266 Interrupts and Timers using Arduino IDE (NodeMCU)
April 18, 2020 - Interrupts allow you to detect changes in the GPIO state without the need to constantly check its current value. With interrupts, when a change is detected, an event is triggered (a function ...
🌐
Arduino Forum
forum.arduino.cc › projects › programming
ESP8266 Interrupt problems / Rst cause:2 problems. - Programming - Arduino Forum
October 30, 2019 - Hi everyone. I'm using a NodeMCU ESP8266 with the Arduino IDE, and for the code I'm writing I need an interrupt, but I can't make it work. This is the general code that I'm using to test the interrupt behaviour/problems in the ESP8266: #define ICACHE_RAM_ATTR const int interruptPin = 14; void setup() { pinMode(LED_BUILTIN, OUTPUT); pinMode(interruptPin, INPUT_PULLUP); ICACHE_RAM_ATTR; attachInterrupt(digitalPinToInterrupt(interruptPin), handleInterrupt, CHANGE); Serial.begin(1...
🌐
Edaboard
edaboard.com › digital design and embedded programming › microcontrollers
[SOLVED] - ESP8266-01 Interrupts | Forum for Electronics
June 24, 2020 - What i expect from code, that when i press button that connects pin 2 to GND it should trigger the interrupt, that is because i pulled up pin 2 internally (thought i also tried external pull up) and i set pin 2 to trigger interrupt on falling edge that means when i push button to ground it should trigger the interrupt and serial monitor should show "Interrupt Ocurred: 0" But what happens when i turn on the ESP without any interaction serial monitor prints "Interrupt Ocurred: 1" after every 1 second, that means pin 2 is properly pulled up, and its not falling edge but still interrupt was triggered. ... Ahh found the issue, while writing reply to you i realized i used assignment operator instead of equal so i change isrInterrupt_A = 1 to isrInterrupt_A == 1 and it works, thanks, ... ESP8266 Wemos D1 mini I2C problem.
🌐
ESP8266 Arduino Core
arduino-esp8266.readthedocs.io › en › 3.0.2 › reference.html
Reference — ESP8266 Arduino Core 3.0.2 documentation
Receive is interrupt-driven, but transmit polls and busy-waits. Blocking behavior is as follows: The ::write() call does not block if the number of bytes fits in the current space available in the TX FIFO. The call blocks if the TX FIFO is full and waits until there is room before writing more ...
🌐
Everything ESP8266
esp8266.com › viewtopic.php
Interrupts on NodeMCU - Everything ESP8266
I have used delaymicros() instead. Thanks for the help !!! void interruptISR() { digitalWrite(blue, HIGH); // turn on blue LED delayMicroseconds(1000000); // delay 1s digitalWrite(blue, LOW); // turn off blue LED // Wait for two seconds (to demonstrate the active low LED) }