From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
Hello. How can i know when an instruction is finished. I need to read the serial port when my robot has finished to execute an instruction to see what is his answer, and i only can to read at the end of the instruction.
There is a property node for "Bytes at Port" on the Serial palette. Provided the robot's answer is always the same number of bytes, you can just keep checking till you have the number of bytes that you expect, then read the port.
Hello jasonhill. You are right, but the problem is that i don't know the answer of the robot. Sometimes he returns "done", or "control enabled", or another thing.
Does the robot send a termination character at the end of each message? Like carriage return, line feed, etc. If so, then read until this character is recieved.
~~~~~~~~~~~~~~~~~~~~~~~~~~ "It’s the questions that drive us.” ~~~~~~~~~~~~~~~~~~~~~~~~~~
Do you have a list of all possible responses? If the first character is unique for each possible response, you could read the first bit and then determine how many more bits you need to get the entire message.
If not the first character, the first two? Three? ect? Obviously, for a sufficiently large range of responses, this can become unmanageable. I am hoping your robot is dumb enough to only have a couple.