-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_over_ssh.py
33 lines (26 loc) · 928 Bytes
/
test_over_ssh.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# test_over_ssh.py
import time
import sys
import simplessh
start = time.time()
con = simplessh.Connection()
# Test python execution
# con.execute('python test_keithley.py')
# truncate -s 0 output_prologix.txt;
# Set up Prologix Commands
con.execute(r'echo ++mode 1 >/dev/ttyUSB0; ')
con.execute(r'echo ++ifc >/dev/ttyUSB0; ')
con.execute(r'echo ++read_tmo_ms 200 >/dev/ttyUSB0; ')
# con.execute(r'echo ++addr 1o >/dev/ttyUSB0; ')
# con.execute(r'\x03')
time.sleep(1)
con.execute(r'echo ++addr 10 >/dev/ttyUSB0; ')
# con.execute(r'echo *CLS; >/dev/ttyUSB0; ')
# con.execute(r'echo INIT:CONT OFF; >/dev/ttyUSB0; ')
con.execute(r'truncate -s 0 output_prologix.txt;stty raw -echo < /dev/ttyUSB0; tail </dev/ttyUSB0 > output_prologix.txt | echo *IDN? >/dev/ttyUSB0; ')
time.sleep(1)
con.get('output_prologix.txt')
x = open('output_prologix.txt')
print(1)
[print(line) for line in x]
x.close()