General area when it fits no where else

Moderator: Mmiscool

User avatar
By Electroguard
#46880 Hey, we're learning this interrupt thing together pal, so that html line was just an overlooked hanger-on from when I was debugging why interrupt wasn't toggling due to the high and low interrupts effectively cancelling out the toggle.
Just delete it.
It might even account for why the ESP resets after so mant toggles - the parser seems to keep stumbling on after many 'var' type errors before eventually having a nervous breakdown.
I would also make sure you're running the latest (A21) release, cos although new releases may possibly introduce some previously unknown problems, they invariably do fix most previous know instability issues.

If the pin is too sensitive I would think it's probably because the pullup resistor isn't strong enough - something around 5K to 20K should be ok, but you could go down to 1K if necessary and battery life was not a particular issue. The other thing to watch for is keep your pullup resistor wires as short as practically possible, cos they'll effectively be acting as aerials for any invisible emf... unfortunately that's probably easier said than done if you're using a breadboard for connecting up the pullup resistor.
User avatar
By Mmiscool
#46898 When an interup is triggered you can use the function
Code: Select allio(laststat,{pin no})

to see that the status of the pin was that triggered the interrupt. In this way you can check and toggle on only a high or only a low.

You may also use this function to see what the pin was last set to with a po.

Both methods are demonstrated below.

example:
Code: Select allinterrupt d3 [toggle]
wait

[toggle]
if io(laststat,d3) = 0 then
    if io(laststat,d4) = 0 then io(po,d4,1) else io(po,d4,0)
end if
wait
User avatar
By kumaran512
#47059 Thanks electroguard and Mmiscool, you both are cool. Got it working.....will post more if any doubt prevails..... :D

Added 20K resistor and sensitivity is reduced. And I use the latest Espbasic firmware.

So far so good.