Login  Register

Re: do/while loop, I think?!

Posted by Weller Andrew Francis on May 23, 2006; 12:53pm
URL: http://imagej.273.s1.nabble.com/Microscope-stage-controller-and-serial-communication-Javacomm-tp3702708p3702713.html

Hi Joachim,

Yes, this may be true with "waitanswer" - I will have to play some more. If it
turns out not to be the case, then I think your second do/while loop will be
the answer.

Thank you, Andy

On Tuesday 23 May 2006 01:37, Joachim Wesner wrote:

> Hi Andy,
>
> I´m not sure I fully understand your setup/problem, also because I do not
> know that serial plugin you use.
>
> 1) What does "waitanswer" mean? I would assume it would already tell the
> plugin to NOT return before anything is sent back by the microscope, so
> you would probably need no extra do/while at all (you still might need to
> check if the result was different from what you expect)
>
> 2) Otherwise, if it returns earlier, will you still be able to later (and
> repeatedly) read the reply using getResultLabel(0)?
> Then you could use a do/while construction like
>
> run(.....);
> do {
>     answer = getResultLabel(0);
>     } while (answer != "50020xyz");
>
> (or probably simpler)
>
> run(.....);
> do {
>     answer = getResultLabel(0);
>     } while (answer == "");
>
> Sincerely
>
> Joachim