-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOpc_Client_test.py
More file actions
36 lines (28 loc) · 1.04 KB
/
Copy pathOpc_Client_test.py
File metadata and controls
36 lines (28 loc) · 1.04 KB
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
34
35
36
from Capture import Opc_Client
from Capture.Opc_Client import OpcClient, address_text,address_trigger, set_synchro, get_text, kill_synchro, get_repetions
from environement import default_opc_server, test_setup
import OpenOPC
import time
def callback():
print("Taking picture now")
if __name__ == '__main__':
print("Trying to connect to server " + default_opc_server)
print("\n ====================================\n")
try:
address_text = "." + address_text
if test_setup:
address_text = "." + address_text
address_trigger = "." + address_trigger
with OpcClient(default_opc_server) as opc:
opc.opc[address_text] = 'test42'
set_synchro(callback)
for i in range(20):
time.sleep(1)
string = get_text()
print('Reading the text', string)
print('repeats:', get_repetions())
kill_synchro()
print("end test")
except OpenOPC.OPCError as e:
print('Error', e)
input('press enter key to exit..')