-->
Page 2 of 3

Re: Using esp-01 RX as input... How??

PostPosted: Sun May 14, 2017 8:00 am
by Luc Volders
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

Re: Using esp-01 RX as input... How??

PostPosted: Mon May 15, 2017 9:14 pm
by heckler
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:

Re: Using esp-01 RX as input... How??

PostPosted: Tue May 16, 2017 12:39 pm
by nedudgi
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.

Re: Using esp-01 RX as input... How??

PostPosted: Tue May 16, 2017 5:23 pm
by Electroguard
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