Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
Hello everybody,
Is it possible to construct better program in Macro for the data exchange between Arduino and ImageJ? Ext.write("a"); // send an order to Arduino wait (7000); // delay 7 s till the Arduino finish the necessary performance and send confirmation !!! data=Ext.read(); if {data == "Z") { // ImageJ Macro do something else { // ImageJ Macro do something another .... My question is directed especially for the line 2 and 3 - how to construct Macro delay - the program should wait exactly till the data=="Z" Regards Marcel Krzan -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
On Tuesday 29 Oct 2013 16:58:03 you wrote:
> Hello everybody, > > Is it possible to construct better program in Macro for the data exchange > between Arduino and ImageJ? Yes, Jerome Mutterer was involved in this (although I haven't tried it yet): http://imagejdocu.tudor.lu/doku.php?id=plugin:utilities:serial_macro_extensions:start Cheers Gabriel -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
In reply to this post by Marcel Krzan
Hi Marcel,
check this http://playground.arduino.cc/Interfacing/Java to see how a SerialPortEventListener can be implemented. You can register this type of listener and react on incoming messages instead of waiting. Regards, Peter On 29.10.2013 17:58, Marcel Krzan wrote: > Hello everybody, > > Is it possible to construct better program in Macro for the data exchange > between Arduino and ImageJ? > > Ext.write("a"); // send an order to Arduino > > wait (7000); // delay 7 s till the Arduino finish the > necessary performance and send confirmation !!! > > > > data=Ext.read(); > > if {data == "Z") { // ImageJ Macro do something > > else > > { // ImageJ Macro do something another .... > > My question is directed especially for the line 2 and 3 - how to construct > Macro delay - the program should wait exactly till the data=="Z" > > Regards > > Marcel Krzan > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > ... [show rest of quote] -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
In reply to this post by Marcel Krzan
Dear Marcel,
you could poll the serial port at shorter intervals and wait for a given answer to be read. You can do this with a do/while loop: data =""; do { data = Ext.read(); wait(500); } while ( !startsWith(data,"Z") ) Sincerely, Jerome. On 29 October 2013 17:58, Marcel Krzan <[hidden email]> wrote: > Hello everybody, > > Is it possible to construct better program in Macro for the data exchange > between Arduino and ImageJ? > > Ext.write("a"); // send an order to Arduino > > wait (7000); // delay 7 s till the Arduino finish the > necessary performance and send confirmation !!! > > > > data=Ext.read(); > > if {data == "Z") { // ImageJ Macro do something > > else > > { // ImageJ Macro do something another .... > > My question is directed especially for the line 2 and 3 - how to construct > Macro delay - the program should wait exactly till the data=="Z" > > Regards > > Marcel Krzan > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > ... [show rest of quote] -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Free forum by Nabble | Disable Popup Ads | Edit this page |