I have a program in which there are 3 things to be done;
1) Keep flashing an LED independently
2) Send a UDP reply ("open" / "closed") depending on the state of a pin and
3) Receive a character over UDP and send the same back as an acknowledgement to the sender.
The attached code starts of working fine, but a few characters later (random, no pattern noticed) the ESP does not ping back the received characters. At this point, the switch reading the pin is still working, and transmitting back the pin status, whenever it changes. The LED is also flashing as it should be.
Its only the UDP characters that are not being received (accepted) by the ESP.
I have tested this with Ciccio's UDP debugger as well as an Android UDP sender/receiver.
relay = 0 'Relay on gpio.0
led = 2 'Led on gpio.2
switch = 3 'Door switch on gpio.3
io(po,relay,0)
pwd = read.val("myfile")
udpbegin 5001
interrupt 3, [shutter]
timer 1500, [blipLED]
[begin]
udpbranch [udpreceived]
wait
[udpreceived]
let msg = udpread()
UDPREPLY msg 'Acknowledge BACK to sender
delay 100 'for keypad beeps
goto [begin]
return
end
[blipLED]
io(po,led,1)
delay 1
io(po,led,0)
wait
[shutter]
if io(laststat,3) == 1 then UDPREPLY "open" else UDPREPLY "closed"
wait
I'm sure I'm doing a number of wrong things here, but cant really figure out what.
Any help would be highly appreciated, folks!
Regards.