by [Theo Verelst] [http://82.170.247.158/Wiki/dsc00194b.jpg] proc slidsend { {n} {v} } { set w [format "%.2x" [expr $v+191]] send "00$w$w$w" } proc slidsendupdate { } { # send update } set sock {} proc send { {line {\n}} } { global sock if {$sock == -1} { # log "(failed attempt to send:\n$line)\n" return } puts $sock $line flush $sock # log $line\n } proc log a {puts -nonewline $a} set sock [socket 192.168.1.38 4448] #sliders {{vol 255}} wm geometry . 88x478 scale .sl .sl conf -from 64 -to -191 -tickinterval 32 -command {slidsend 0 } pack .sl -expand y -fill y [http://82.170.247.158/Wiki/volume1.jpg] set sock [socket -server connect 4448] set s1 {} proc connect {s host port} { global s1 set s1 $s fconfigure $s1 -blocking 0 -buffering line fileevent $s1 readable [list handleSocket $s1] } proc handleSocket {s} { gets $s line if {[eof $s]} { close $s set s -1 return } if {$line eq ""} return w $line } set fh [open /dev/ttyS2 RDWR] fconfigure $fh -blocking 0 -mode 115200,n,8,1 -translation binary \ -buffering full fileevent $fh readable { set w [read $fh] ; foreach c [split $w {}] { binary scan $c H* a; set v $a if {$s1 != {}} {puts $s1 "$v"} # flush stdout } } proc w h { global fh puts -nonewline $fh [binary format H* "$h"] ; flush $fh } w 00 ; w C0 ; w C0 ; w C0 # after 500 exit vwait forever [http://82.170.247.158/Wiki/scrvol1.jpg]