General area when it fits no where else

Moderator: Mmiscool

User avatar
By Luc Volders
#65917 Ok, Ok spoiling an upcoming story on my weblog I herebye give you the code that works:

Code: Select alltimer 1000, [blink]
button "off", [gooff]
wait

[gooff]
end

[blink]
for i = 0 to 3
  io(po, i, 1) 
  delay 1000
  io(po, i, 0) 
next i
wait


Have fun
Luc
User avatar
By heckler
#65959 Thanks everyone for your input.

So I have this working...
Code: Select allbtn = io(pi,rx)
if btn = 0 then goto [BtnLow]


I tried to use the interupt function on the RX pin but can't get it to work. But I found a sort of work around by just repeatedly testing for the RX pin to go high.

If anyone knows how to get the
Code: Select allinterrupt rx, [change]
to work please share.

But I am moving on as my needs for now are met.

thanks
dwight

PS.. curious to me is why everyone's example and direction were how to use RX as an output, when my original question was how to use RX as an INPUT?? :roll:
User avatar
By nedudgi
#65983 Now I have no possiblity to make a test, but I think, the
btn = io(pi,rx)
obligatory statement changes the pin mode to input, so after this You can use the interrupt command.
User avatar
By Electroguard
#65991 ESP-01 doesn't have a pin called rx or RX in Esp_Basic, if it's gpio03 it needs to be addressed as 3.
So you would either need to define RXpin = 3 then assign the interrupt to that variable name (interrupt RXpin, [Branch]), else assign the interrupt directly to the actual pin number (interrupt 3, [Branch])... but that's untested advice.

As TX was previously mentioned it's probably worth pointing out that using it (gpio01) screws with serial coms and vice versa, so you would possibly also need to make use of...
GPIO1RESET():
Restore the normal behaviour of the serial port TX pin.
gpio1reset()
This is useful when the pin GPIO1 has been modified with commands like
po 1 0