-->
Page 1 of 2

serialbranch

PostPosted: Fri Dec 09, 2016 1:40 pm
by stern0m1
Im having an issue reading the serial port. I am using serialbranch. I tested it with a serial usb adapter connected to a terminal. It only jumps to that branch the first time something is received. After the first time nothing happens. I checked my connections and tried different usb serial adapters.

I am running ESP Basic 3.0.Alpha 64.

Any help will be greatly appreciated.

Thanks


Here's my code:


button "send" , [se]
textbox text

serialbranch [ser]

wait

[se]

SERIALPRINTLN text

wait

[ser]
serialinput s
print s


wait

Re: serialbranch

PostPosted: Fri Dec 09, 2016 2:50 pm
by stern0m1
I worked around it by using a soft serial and closing it and opening by the serial interrupt branch.

Seems like the serial ports interrupt is not being reset. I dont see any way in basic to do that.

Thanks

Re: serialbranch

PostPosted: Fri Dec 09, 2016 4:16 pm
by Electroguard
Your serial [branch] subroutine should end with a RETURN rather than WAIT, so that it can go back to look for more incoming serial.

Also, pay attention to where you insert spaces, cos where your button command is expecting a comma delimiter it is actually seeing a space in front of the comma.

Re: serialbranch

PostPosted: Sat Dec 10, 2016 8:49 pm
by stern0m1
That worked.
I just dont understand when to use wait and when return.
My send branch if I end with return, the debugger says "return without gosub"

thanks