If 'bi1' is a numeric variable name which should be set to 0 or 1 depending on the incoming udp msg, then set it to something else at the start of the program so you can check its value in one of the 2 Variable windows in the Editor (see pic) after seeing an incoming udp msg in the wlog window.
That will help you to see what causes any change, and if the change is what you expect.
Don't forget you can temporarily insert END into any of the responding subroutines to 'freeze' var values which can then still be checked in the Variable windows even after the script has stopped.
Likewise you can keep moving a temporary END to different parts of your program to pinpoint where your variables are starting to go wrong.
I've inserted some wlog lines into your code to show the sort of thing which might help.
goudp:
v$ = udp.read$ 'receive the UDP data
wlog "incoming udp msg = " + v$
If v$ = "Relais1=1" Then
wlog "Relais1=1"
vgaGui.SetValue bi1, 1
UDP.REPLY "Relais1 gesetzt"
ENDIF
If v$ = "Relais1=0" Then
wlog "Relais1=0"
UDP.REPLY "Relais1 rückgesetzt"
vgaGui.SetValue bi1, 0
ENDIF
wlog "bi1=" + str$(bi1)
return
My 'EasyNet' devices communicate with each other by checking incoming UDP msgs for "Target Instruction Data" messages.
It has got quite complex, but if something is not responding as expected it is still fairly easy to enable appropriate wlog lines to check if the msg was received, if it was correct, if it was recognised, and if the appropriate subroutine called, etc.
Code: [Local Link Removed for Guests]
udpRX:
RXmsg$ = udp.read$
'wlog rxmsg$
RXin$ = word$(udp.remote$,1,":") + " at " + time$ + " on " + date$ + " "
if nameserver = 1 then
'wlog "incoming", udp.remote$, RXmsg$
word.setparam netlist$, udp.remote$, RXmsg$ + " at " + time$ + " on " + date$ + chr$(13)
endif
target$ = ucase$(word$(RXmsg$,1)) 'Target may be NodeName or GroupName or "ALL" or localIP address
this=0
if (target$=nodeIP$) OR (target$=localIP$) OR (target$=ucase$(nodename$)) OR (instr(ucase$(groupname$),target$)>0) OR (target$="ALL") then
instruction$ = trim$(ucase$(word$(RXmsg$,2))) 'Instruction is second word of message
getdata data$,RXmsg$," ",2 'extract any data that follows the instruction
select case instruction$
case "NETLIST" : gosub netlist
case "TIMESYNC" : gosub timesync
case "OUTSIDE" : gosub outside
case "OFF" : gosub netOFF
case "ON" : gosub netON
case "UP", "+" : gosub setu
case "DOWN","-" : gosub setd
case "TOGGLE" : gosub netToggle
case "","?" : gosub this
case "RESTART" : msg$="Remote reboot":gosub Restart
case else
if word.find(ucase$(instructionslist$),instruction$)>0 then
gosub instruction$
if dbug=1 then wlog "been there("+instruction$+"), done that"
else
if dbug=1 then wlog "Instruction "+instruction$+" not recognised from "+RXin$'+"("+RXmsg$+")"
endif
' onerror skip
' gosub instruction$
' wlog "ouch"
end select
endif '(target$=)
refresh
return