TimerOne.h library for nodeMCU Following is the code I found in Arduino example files. It compiled fine on Arduino UNO. But there was an error when I tried to compile it for nodeMCU 1.0(ESP 12E Module).

#include &lt;TimerOne.h&gt;
void setup() {
  pinMode(13,OUTPUT);
  Timer1.initialize(5000000);//5 sec
  Timer1.attachInterrupt(timerIsr);
}
void loop() {}
void timerIsr(){
  digitalWrite(13,!digitalRead(13));
}


Following was the error message. I had this kind of error previously on OneWire.h and I solved it by replacing the OneWire.h library with another OneWire.h library that was made especially for nodeMCU.

Error msg:

Arduino: 1.8.3 (Windows 8.1), Board: "NodeMCU 1.0 (ESP-12E Module), 80 MHz, 115200, 4M (3M SPIFFS)"

In file included from D:\iox Prime\TEC project\code\building modules\timerIsrDemo\timerIsrDemo.ino:1:0:

C:\Program Files (x86)\Arduino\libraries\TimerOne/TimerOne.h:39:20: fatal error: avr/io.h: No such file or directory

 #include &lt;avr/io.h&gt;

                    ^

compilation terminated.

exit status 1
Error compiling for board NodeMCU 1.0 (ESP-12E Module).

This report would have more information with
"Show verbose output during compilation"
option enabled in File -&gt; Preferences.


I searched the library everywhere in the internet to solve this error but end up with no success. I wish somebody modifies the existing library for me. Thank you for the help.
I have found a solution. There is a library called Ticker.h
I found this on github: https://github.com/esp8266/Arduino/tree/master/libraries/Ticker

Following is my demo code:

#include &lt;Ticker.h&gt;
Ticker ticker;
void setup() {
  pinMode(D7,OUTPUT);
  ticker.attach(1,isrFunc);//tickerObj.attach(timeInSecs,isrFunction)
}

void loop() {}
void isrFunc(){
  digitalWrite(D7,!digitalRead(D7));
}


For me, this code worked seamlessly on nodeMCU. Thank you.