Good example of ESP8266 interrupts using timer and pin
ESP8266 Combined timer and pin interrupts to measure wind speed sensors