Playing with Applescript communicating with the Arduino Uno I noticed an issue
that might be related to the LiveCode problem of hanging during a connection.
In the Applescript that works I close the port first and then return the result
as in:
set tSerialReturn to serialport read portRef for revRead
set rSerialReturn to tSerialReturn as string
serialport close portRef
return rSerialReturn
But, if I try to return results in the script before issuing the close port the
application again hangs with the spinning beach ball as in:
set tSerialReturn to serialport read portRef for revRead
set rSerialReturn to tSerialReturn as string
return rSerialReturn
serialport close portRef
I have to unplug the Arduino Uno to get control back. But if I present an
Applescript dialog with info read during the script cycle it is fine and does
not hang so it must be something in the way the return returns data.
The thing is I can run the first script over and over again and it works every
time (opening and closing the port in a loop) but if I try to do the loop of
reading and return the result before closing the port it hangs every time.
QUESTION: Is it possible that LiveCode is also doing this as well. i.e. Keeping
the port open while sending results back causes a hang? This would be difficult
to return sensor results if it required multiple open closes for each chunk of
data. And between closes and opens would result in lost data from continuos
data streams.
Thanks,
-- Tom McGrath III
http://lazyriver.on-rev.com
[email protected]
On Jan 24, 2011, at 11:45 PM, Thomas McGrath III wrote:
> Well, I got tired of testing and waiting for a solution to LiveCode directly
> connecting, sending, and receiving serial data to/from the Arduino Uno and
> found an alternative method instead. In this stack I use an Applescript OSAX
> and control that from within LivceCode via Applescript. I hacked together a
> test stack and uploaded it to Rev Online : Applescript Arduino -- Thomas
> McGrath III. Complete with Sample Arduino IDE Sketches and Applescript
> Scripts and LiveCode Scripts and with a mini tutorial on how to put it all
> together.
>
> Although this solution works, it is not optimal since it is a Macintosh only
> solution and is not the preferred way to do this. It adds a level of
> complexity where one should not be needed. We still need to be able to
> connect to a serial port/modem from within LiveCode beyond the old FTDI
> Virtual Serial Port methods.
>
> Download and Enjoy,
>
>
> -- Tom McGrath III
> http://lazyriver.on-rev.com
> [email protected]
_______________________________________________
use-livecode mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode