I am writing a code, so when the robot starts in creates a tcp socket and and it gets stuck on that code line, it is meant to create it, and then move on to listen it for incoming data from pc, Vision builder AI (NI soft).
THE CODE:
resultCreate1,socket1 = TCPCreate(true, ‘192.168.5.10’, 6601)
if resultCreate1 == 0 then
print(“Create TCP Server Success!”)
else
print(“Create TCP Server failed, code:”, resultCreate1)
end
TCPStart(socket1, 0)
–print(‘created’)
–Sync()
–print((resultCreate1))
Sleep(10)
Sync()
while 1 do
DO(16,1)
Wait(500)
DO(16,0)
resultRead1,x = TCPRead(socket1, 0,‘string’)
x = x.buf
x = tonumber(x)
Sleep(10)
Sync()
print(‘x:’)
Sync()
print(x)
resultRead1,y = TCPRead(socket1, 0,‘string’)
y = y.buf
y = tonumber(y)
Sleep(10)
Sync()
print(‘y:’)
Sync()
print(y)
Sleep(500)
MovJ(({coordinate = {x,y,0,0}, tool = 0, user = 0}))
DO(9,1)
Sleep(1000)
RelMovL({0,0,-92,0})
DO(9,0)
DO(10,1)
Sleep(3000)
RelMovL({0,0,92,0})
MovJ(({coordinate = {300,-150,0,0}, tool = 0, user = 0}))
DO(10,0)
Sleep(2000)
end