I asked Vladimir in passing how he preferred to talk to things via the serial port, and he wrote this. It is now contained in /users/dmass/scripts/serial_test.tcl :
#!/usr/bin/env tclsh
global SERPORT
set SERPORT [open "/dev/ttyS0" "w+"]
fconfigure $SERPORT -mode 9600,n,8,1 -handshake none -buffering line
proc run_query { command } {
global SERPORT
puts $SERPORT "$command"
flush $SERPORT
gets $SERPORT line
return $line
}
#@puts [run_query "BEEP?"]
while { 1 } {
puts "[clock format [clock seconds]]\t[run_query "TEC:T?"]"
after 100
} |