Login  Register

do/while loop, I think?!

Posted by Weller Andrew Francis on May 22, 2006; 6:04pm
URL: http://imagej.273.s1.nabble.com/Microscope-stage-controller-and-serial-communication-Javacomm-tp3702708p3702711.html

Dear all,

I am controlling a microscope through the serial interface that both reads and
writes strings. What I would like it to do is only proceed to the next
command after the current one has completed. This is acknowledged by the
microscope re-sending the original command.

So, for example, if I send the microscope the command "50020xyz" the macro can
only continue once "50020xyz" has been returned. In macro code this is:

run("serial plugin", "waitanswer genericcmd=50020xyz");
//to retrieve the answer through the macro
answer = getResultLabel(0);

So, while answer = "" I want the macro to stay idle, but when answer =
"50020xyz" I want the macro to continue. I guess this needs a do/while loop
(maybe if/then!?)?!

I can't get my head round it at the moment and wonder if anyone has any
ideas/suggestions?

Many thanks, Andy