Use this forum to chat about hardware specific topics for the ESP8266 (peripherals, memory, clocks, JTAG, programming)

User avatar
By thule
#56016 Hi folks

Before I complain about my problem, "Thanks for all the hard work on esp8266, nodemcu and elua." These things allow us mere mortals to tinker with toys :-)

I am trying to raise an interrupt on falling edge. I will attach my schematic and the code. It does not matter whether I try to pull up, not pull up, use the "up" or "high" and give it 3v3 or use "down" or "low" and ground the pin, the nodemcu lua crashes. It reports the reset reason is wdt reset.

I also tried it on several different pins.

Any help?

Thanks

Code: Select allipin=12
last=tmr.now()

function intcb(level)
     if tmr.now()>last+100 then
     print("hi there")
     end
     return
end

gpio.mode(ipin,gpio.INT,gpio.PULLUP)
gpio.trig(ipin,"down",intcb)

You do not have the required permissions to view the files attached to this post.
User avatar
By thule
#56155 No takers :|

I tried a different board, similar problems. Keeps resetting the lua. Instead I tried using the arduino IDE with arduino code for esp8266, and used similar mechanism. It worked fine. It is for a wearable. So w/o an interrupt mechanism to bring on the screen, the whole project is unusable. May be rewrite it in c using arduino IDE!

arduino ide with core for esp8266 - c code below:

Code: Select allunsigned long last=0;

void setup() {
  // put your setup code here, to run once:
Serial.begin(9600);
pinMode(12,INPUT_PULLUP);
attachInterrupt(12,prnx,CHANGE);
}

void prnx(){
  if ((millis()-last)>1000) {
  Serial.println("hi");
  last=millis();
  }

}


void loop() {
  // put your main code here, to run repeatedly:

}


Lua code below :
Code: Select allipin=12
last=tmr.now()

function intcb(level)
     if tmr.now()>last+2000 then
     print("hi there")
     end
     return
end

gpio.mode(ipin,gpio.INT,gpio.PULLUP)
gpio.trig(ipin,"down",intcb)


It can't be that interrupts are not possible!
Any help greatly appreciated.

Thanks