-->
Page 1 of 1

Interrupt crashing the esp8266

PostPosted: Mon Oct 03, 2016 3:48 pm
by thule
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)


Re: Interrupt crashing the esp8266

PostPosted: Tue Oct 04, 2016 11:26 am
by thule
I also tried a breadboard power supply to keep the vin happy at 5v. Any suggestions?

Re: Interrupt crashing the esp8266

PostPosted: Thu Oct 06, 2016 12:54 pm
by thule
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