Sending a trigger:
socket_send_string(“SW8”, socket_name)
socket_send_byte([13,10], socket_name)
triggerstatus = socket_read_line(socket_name)
if triggerstatus == “1”:
textmsg("Trigger successful: ", triggerstatus)
else:
textmsg("Trigger failed: ", triggerstatus)
end
returns a trigger failed with a trigger status of -2
Insight help just gives “Command Cannot Be Executed” as the explanation for error code -2.
I have copy pasted the code from the integration practicum, and manually set a string in cell C20. Communication between the robot and cognex works, a few lines in the copy pasted code:
socket_send_string(“GVC020”, socket_name)
socket_send_byte([13,10], socket_name)
getvaluestatus = socket_read_line(socket_name)
if getvaluestatus == “1” :
textmsg("GetValue successful: ", getvaluestatus)
else:
textmsg("GetValue failed: ", getvaluestatus)
end
I think on the cognex. The trigger status integer will only be 1 if the trigger mode is set correctly (in the Image settings in cell A0) and if the camera is in “Online mode”.
Maybe putting it in online mode makes it work already.