Showing results for 
Search instead for 
Did you mean: 

instruction time

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.

0 Kudos
Message 1 of 5
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.
0 Kudos
Message 2 of 5
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.

What can i do?

0 Kudos
Message 3 of 5
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.”
0 Kudos
Message 4 of 5
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.
0 Kudos
Message 5 of 5