Here is my second attempt at a demo program. I defined null$, and header$ as global constants for efficiency. I also put the code in a double loop to stream the data to the receiver and recover from loss of signal. I set the wait delay to 25 ms. We need to find the longest delay that will still work just so people will know. Let me know if this works. I'm going to have to get one of those receivers.
Global null$, header$
null$ = chr$(0)
header$ = chr$(85) + chr$(0) + chr$(11) + chr$(0)
do
Print "Attempting to connect…"
wait 1
TcpOpen 1, "10.10.100.254", 8899, "c", 12000, 1000
if TcpGetState(1) = 1 then
Print "Connected"
wait 1
do while TcpGetState(1) = 1
' set your channel values here.
sendRawChannels(0, 25, 50, 100)
wait 50
loop
endif
Print "Not Connected"
Print TcpGetError$(1)
TcpClose 1
loop
end
Sub sendRawChannels(ch1, ch2, ch3, ch4)
' Add header
packet$ = header$
' Add channel values
packet$ = packet$ + chr$(ch1 & 255)
packet$ = packet$ + chr$(ch2 & 255)
packet$ = packet$ + chr$(ch3 & 255)
packet$ = packet$ + chr$(ch4 & 255)
' Two bytes not used
packet$ = packet$ + null$
packet$ = packet$ + null$
sum = 0
for i = 1 to 10
sum = sum + ascii(mid$(packet$, i, 1))
next
' Add checksum byte
packet$ = packet$ + chr$(sum % 256)
TcpWrite 1, packet$
End Sub