ESP8266 12F Interrupt GPIOs

Which pins are available for interrup in esp8266 12f? ( I.E. attachInterrupt(digitalPinToInterrupt(5), checkPin, CHANGE);

GOOGLE is your friend… a quick search of your title phrase found this at the top:


Pin interrupts are supported through attachInterrupt(), detachInterrupt() functions. Interrupts may be attached to any GPIO pin except GPIO16, but since GPIO6-GPIO11 are typically used to interface with the flash memory ICs on most esp8266 modules, applying interrupts to these pins are likely to cause problems. Standard Arduino interrupt types are supported: CHANGE, RISING, FALLING.

Thanks Gunner, when I push the buttom (Interrup to GND) seems that the interruption is fired and the system crash, I mean it goes offline and stop making all the other instructions, what can be the reason?

    //needed for library
#include <DNSServer.h>
#include <ESP8266WebServer.h>
#include <WiFiManager.h>         //

 // ****************************************************************
 #include <Ultrasonic.h>  // se incluye la librería ultrasónica

 Ultrasonic ultrasonic(14,4); // (Trig PIN,Echo PIN)

 // *************************************************************

#include "DHT.h"

#define DHTPIN 0    // what pin we're connected to
#define DHTTYPE DHT22   // DHT 22  (AM2302)

//  ******************************************************************

#include <SimpleTimer.h>
SimpleTimer timer;

//  ****************************************************************

#define BLYNK_PRINT Serial    // Comment this out to disable prints and save space
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

char auth[] = "8a9c8df766c84ed99380391f34d653ea";

WidgetLED led1(V10);
WidgetLED led2(V12);

void checkPin()                                       // *************************************************PARA INTERRUPCION EXTERNA


  // Invert state, since button is "Active LOW"
  Serial.print(" INTERRUPCION ");  

  if (digitalRead(5)) {;

  } else {




//void CONECTAR()

void sendTEMP()
  // Reading temperature or humidity takes about 250 milliseconds!
  // Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)
  float h = dht.readHumidity();
  // Read temperature as Celsius
  float t = dht.readTemperature();
  // Read temperature as Fahrenheit
  float f = dht.readTemperature(true);

  // Check if any reads failed and exit early (to try again).
  if (isnan(h) || isnan(t) || isnan(f)) {
    Serial.println("Failed to read from DHT sensor!");

  // Compute heat index in Celsius (isFahreheit = false)
  float hic = dht.computeHeatIndex(t, h, false);

  int pir = digitalRead(16);  // ***********************************  Sensor PIR conectado a GPIO16

  float ult = ultrasonic.Ranging(CM); // CM o INC


  Serial.print(" Temperatura *C: " );  

  Serial.print(" Humedad %: " );  

  Serial.print(" Sensacion termica *C: ");  

  Serial.print(" Sensor de movimiento: ");

  Serial.print(" Distancia en cm: ");   




//  ********************************************************************************

void setup()              //---------------------------------------------------------------------- SETUP -------------------------------------------------------------

  //timer.setInterval(4000, CONECTAR); //1000=1s
  WiFiManager wifiManager;
  //reset settings - for testing

  //sets timeout until configuration portal gets turned off
  //useful to make it all retry or go to sleep
  //in seconds
 //******************************************* wifiManager.setTimeout(180);
  //fetches ssid and pass and tries to connect
  //if it does not connect it starts an access point with the specified name
  //here  "AutoConnectAP"
  //and goes into a blocking loop awaiting configuration


  pinMode(5, INPUT_PULLUP);
  attachInterrupt(digitalPinToInterrupt(5), checkPin, CHANGE);

  //**********************************************************************    AGREGADO PARA SYNC
while (Blynk.connect() == false) {  }


  dht.begin();                      // INICIAR SENSOR DE TEMPERATURA

  timer.setInterval(5000, sendTEMP); //1000=1s


void loop()                                                           // --------------------------------   LOOP -----------------------------------------------




Albaro solved the problem with interruptions and blynk … is that I also do not work a program that I’m doing and that uses blynk and interruptions … if I don’t using blynk the program that works.

Lo pongo tambien en castellano que mi ingles no es muy bueno.
Albaro solucionaste el problema con las interrupcciones y blynk … es que a mi tampoco me funciona un programa que estoy haciendo y que usa blynk e interrupciones … si dejo de usar blynk si que funciona.


@gurues Old topic :stuck_out_tongue: If you have an issue, please create your own topic and we will try to assist.