Phidgets and externals

Thomas McGrath III mcgrath3 at mac.com
Thu Jul 12 13:06:06 EDT 2012


One of the scripts i was using to connect to the arduino in OSX:

Global gThePort
on mouseUp
    put getMacUSBDriver() into gThePort
    if last char of gThePort is cr then delete last char of gThePort
    replace "tty" with "cu" in gThePort
   put gThePort into thePort

   put quote & thePort & quote into thePortName

    put "" into field "Results"    
    put "BAUD=" & "9600" && "PARITY=" & "N" && "DATA=" & "8" && "STOP=" & "1" && "odsr=" & "on" && "octs=" & "on" && "odtr=" & "on" && "orts=" & "on" into tSerial
    set the serialControlString to tSerial
    if the result is not empty then put "SerialControlString: " & the result into field "Results"
    open driver thePortName for text update
    if the result is not empty then 
      put "Driver: " & the result after field "Results"
    else
       put "Connected" after field "Results"
   end if

end mouseUp


on mouseUp
 close driver gthePort
    if the result is not empty then
        put the result into field "Results"
    else
        put "Port Closed" into field "Results"
    end if
end mouseUp


-- Tom McGrath III
http://lazyriver.on-rev.com
3mcgrath at comcast.net





More information about the use-livecode mailing list