@Zappo
Quote: "I'm not sure I quite understand what you are trying to do either"
Let me try to explain again.
It is a DJI Tello Education Drone.
These drone can ONLY receive UDP messages.
For example. Using examples from the Batch file which is working
1. Send a command to\Initialize the drone... packetsender -u -a 10.105.221.20 8889 command
Now I need to wait for a "Ok" or "Error" return message
If no message within a few seconds, resend the command (The reason I use timeout /t 3" to wait 3 seconds (becauset I cant read the Return Messages in a Batch file.
Lets assume I receive an "Ok"
2. Send second command.... packetsender -u -a 10.105.221.20 8889 takeoff
Wait for an "Ok" to receive...
If The "Ok" message receive excecute the next Message
3. Move forward 100cm .... packetsender -u -a 10.105.221.20 8889 "forward 100"
Wait for an "Ok" to receive...
If The "Ok" message receive excecute the next Message etc etc etc
I use packetsender and it works and return results almost everytime.
Unfortunate the drones only support UDP
I understand how to send/receive, but I can't get it to work with AGKS
The "Drone" don't receive my packets send... So somewhere my code for sending is wrong. If I can get this working, then I can get the receive message
Example of my AGKS code
droneip1 as string = "10.105.221.20"
szIP as string = "10.105.221.1"
port as integer = 8889
szMyName as String = "tello-dev"
n as integer
j = JoinNetwork(szIP,port,szMyName)
localip$ = GetDeviceIP()
listenerID = CreateUDPListener( localip$, port )
iMsgID = CreateNetworkMessage( )
value$ = "Command"
AddNetworkMessageString( iMsgID, value$ )
SendUDPNetworkMessage( listenerID, iMsgID, droneip1, port )
This is the Equivalent code to send the above messages using UDP in my batch file
packetsender -u -a 10.105.221.20 8889 command -- And it works
But I need to use AGKS to send UDP messages as we busy to do a GUI to control the drones (See Attached Screenshot)
Current I'm using this code, which is not only ugly, but the cmd screen popup with every run, and I cant get the return result message (But it works) AGKS need to replace this ....
f = opentowrite("runpos.bat")
st$='"command"'
writeline(f,"packetsender -u -a 192.168.108.199 8889 "+st$)
// agks must send this UDP message
writeline(f,"timeout /t 4")
// instead of the timeout, I wait for a "OK" message return from the Drone
closefile(f)
runapp("runpos.bat","")
Hope this make sense...
Danie