ESP8266-01 Interrupts

Thread Starter

sairfan1

Joined May 24, 2012
103
I'm trying to setup interrupt in arduino based environment using board ESP8266-01, based on help i found on different sites i wrote following code, but when i program my device it continuously shows interrupt message "Interrupt Ocurred: 1" on serial monitor, while same program running if i pull down the pin it shows "Interrupt Ocurred: 0" that means I'm using correct port and it state changes when i do it on hardware, I pulled up pin externally as well, I also tried same program on NodeMCU for different input pins

Arduino:
#include <ESP8266WiFi.h>

const int InterruptPIN = 2;
volatile byte isrInterrupt_A = 0;

void ICACHE_RAM_ATTR IsrInterruptFunction();

void TestInterrupt();

void setup()
{
   Serial.begin(115200);

   pinMode(InterruptPIN, INPUT_PULLUP);
   attachInterrupt(digitalPinToInterrupt(InterruptPIN), IsrInterruptFunction, FALLING);
   Serial.print("Ready");
}  
void loop()
{
    if (isrInterrupt_A = 1) {
      TestInterrupt();
      delay(1000);
      }
     
}

void IsrInterruptFunction() {
  isrInterrupt_A = 1;
}

void TestInterrupt(){

  Serial.println("Interrupt Ocurred: ");
  Serial.println(digitalRead(InterruptPIN));
  isrInterrupt_A = 0;
}
 
Last edited:
Top