usb driver problem

Thomas McGrath III mcgrath3 at mac.com
Sat Jan 15 11:18:26 EST 2011


I am having trouble accessing an Arduino Uno attached to my computer via USB.

The device driver shows up as "/dev/tty.usbmodem1a21"

I tried a simple open driver then read from driver then close driver. But Livecode keeps crashing or worse my computer panics and dies.

on mouseUp
    put "" into field "IOresult"
    open driver "/dev/tty.usbmodem1a21" for binary read // tried text read, text update, binary update
    wait 50
    read from driver "/dev/tty.usbmodem1a21" for 1 line in 4 second // tried for 3 char in 3 seconds, tried until eof
    if it is not "" then
        put "it: " &  it into field "IOresult" 
    else
        put "result: " & the result into field "IOresult"
    end if
    wait 50
    close driver "/dev/tty.usbmodem1a21"
end mouseUp

I just want to read data that is being sent from the board. In Arduino there is a serial monitor which does read the data coming from the board. It is a bunch of numbers one per line as in 1023  then 992  then 992 etc.

I can't seem to figure out what I am doing wrong. This seems pretty straight forward.

I sent an email to Mark Weider but then thought that others might also have ideas.

Thanks


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





More information about the Use-livecode mailing list