source: sans/utils/bt5/tilt/tilt @ 87

Last change on this file since 87 was 87, checked in by ajj, 15 years ago

First version of tilt controller interface. Simple command entry.

File size: 1009 bytes
Line 
1#!/usr/bin/expectk
2
3##################################
4## Talk to tilt controller on bt5
5##
6## Andrew Jackson, April 2007
7##################################
8
9proc exec_cmd {cmd_text} {
10
11        .mf.output insert end "$cmd_text\n"
12        exp_send "$cmd_text\r"
13
14}
15
16
17set port /dev/ttyS0
18set serialid [spawn -noecho -open [open $port w+]]
19set baud 19200
20#stty ispeed $baud ospeed $baud -raw cs8 -parenb -cstopb < $port
21stty -F $port ispeed $baud ospeed $baud raw icrnl
22
23
24frame .mf
25text .mf.output
26entry .mf.cmdentry
27button .mf.ver_but -text "Execute Command" -command { exec_cmd [.mf.cmdentry get] }
28button .mf.init -text "Init" -command {exp_send "\r"}
29pack .mf.output -fill both -anchor nw -expand true
30pack .mf.cmdentry -side left
31pack .mf.ver_but .mf.init -side left
32pack .mf
33
34#expect ">"
35#exp_send "VER\r"
36#expect ">" {.mf.output insert end $expect_out(buffer)}
37
38expect_background {
39        -re ">" {
40                .mf.output insert end $expect_out(buffer)
41        }
42        -re "\\?" {
43                .mf.output insert end $expect_out(buffer)
44        }
45}               
46
47exp_send "\r"
Note: See TracBrowser for help on using the repository browser.