Posted to tcl by dkf at Wed Apr 04 14:18:08 GMT 2012view pretty

package require Tk
package require img::jpeg
set comm [open /dev/ttyACM0 r+]
chan configure $comm -mode -9600,n,8,1 -blocking 0 -buffering none

pack [label .lbb -textvariable accumulator]

proc Reader {fid} {
    global done accumulator
    gets $fid line
    if {[eof $fid]} {
        catch {close $fid}
        set done 1
        return
    } 
    puts $line
    append accumulator "\n$line"
} 
chan event $comm readable [list Reader $comm]
vwait done