-->
Page 1 of 3

Interrupt ?

PostPosted: Wed Apr 20, 2016 5:27 pm
by Electroguard
I think I have the correct interrupt syntax as shown in the Lang Ref, but if I uncomment the interrupt line in the example below it causes crash and reboot.
Could someone tell me if I've got anything wrong please?
(I can't see what it might be, but after being fooled by a turkey looking like a duck, I don't have much confidence in what I'm looking at now!)

Code: Select alllet inputpin = 16              'gpio button
'interrupt inputpin [pressed]
end

[pressed]
print "button pressed"
wait

Re: Interrupt ?

PostPosted: Wed Apr 20, 2016 5:33 pm
by Mmiscool
you need to follow the interrupt command with a wait.

It will only detect an interrupt when in wait state.

Code: Select alllet inputpin = 0             'gpio button
interrupt inputpin [pressed]
wait

[pressed]
print "button pressed"
wait

Re: Interrupt ?

PostPosted: Thu Apr 21, 2016 4:21 am
by Electroguard
Did that work for you? Does the branch cause the msg to be printed if you press the gpio00 flashing button?

Let me take a step back so we're both starting from the same place...
I tried creating a PIR sensor, using gpio16 for convenience. After several frustrated hours, and several reformats and reflashes, I stripped everything down to just the minimal interupt branch on gpio button change, but still no go, which was when I asked the question... but before asking, I changed gpio16 input pin to gpio00 because I knew you would already have that available to use as a test button.

Following your reply I copied and pasted it as-is, and rightly enough it didn't crash and burn, but neither did it print the branch msg, even though the leds showed the gpio00 button was being pressed and should be causing branching.

Thinking there might be something strange with using interrupt for gpio00 button after it has already been ear-marked by the parser for preventing autorun, I changed the input pin back to 16 again... which causes crash and burn again when run.

Thoroughly sick of the sight of it, I stuck it to one side overnight, then reformatted and reflashed today and tried again, but still the same problems.


So after all is said and done... is it possible to use a digital input to trigger an esp-generated response at the moment?

Re: Interrupt ?

PostPosted: Thu Apr 21, 2016 5:51 am
by Mmiscool
Can you use a different pin. Not gpio 16.

It looks like gpio 16 might be a no go. Used by the deep sleep protical.
http://bbs.espressif.com/viewtopic.php?t=632