usb driver problem

xfratboy xfratboy at gmail.com
Tue Jan 25 09:55:13 EST 2011


Have you tried adding about 100 milisec wait before and/or between writes?  

-----Original Message-----
From: "Thomas McGrath III-3 [via Runtime Revolution]" <ml-node+3236281-2059141499-209243 at n4.nabble.com>
Date: Tue, 25 Jan 2011 06:42:33 
To: xfratboy<xfratboy at gmail.com>
Subject: Re: usb driver problem



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
3mcgrath at comcast.net

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
> 3mcgrath at comcast.net

_______________________________________________
use-livecode mailing list
use-livecode at lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


_______________________________________________
If you reply to this email, your message will be added to the discussion below:
http://runtime-revolution.278305.n4.nabble.com/usb-driver-problem-tp3219220p3236281.html

To unsubscribe from usb driver problem, visit http://runtime-revolution.278305.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=3219220&code=eGZyYXRib3lAZ21haWwuY29tfDMyMTkyMjB8OTgzNzQ0MDg2

-- 
View this message in context: http://runtime-revolution.278305.n4.nabble.com/usb-driver-problem-tp3219220p3236297.html
Sent from the Revolution - User mailing list archive at Nabble.com.



More information about the use-livecode mailing list