1'''
2Temperature_TC - TC_read_channel_status.py with synchronous mode.
3
4This example demonstrates how to get status from USBDAQF1TD.
5
6First, it shows how to open thermal port
7Second, get status from channel 0 and channel 1
8Last, close thermal port.
9
10-------------------------------------------------------------------------------------
11Please change correct serial number or IP and port number BEFORE you run example code.
12
13For other examples please check:
14 https://github.com/WPC-Systems-Ltd/WPC_Python_driver_release/tree/main/examples
15See README.md file to get detailed usage of this example.
16
17Copyright (c) 2022-2025 WPC Systems Ltd. All rights reserved.
18'''
19
20## WPC
21from wpcsys import pywpc
22
23
24def main():
25 ## Get Python driver version
26 print(f'{pywpc.PKG_FULL_NAME} - Version {pywpc.__version__}')
27
28 ## Create device handle
29 dev = pywpc.USBDAQF1TD()
30
31 ## Connect to device
32 try:
33 dev.connect("default") ## Depend on your device
34 except Exception as err:
35 pywpc.printGenericError(err)
36 ## Release device handle
37 dev.close()
38 return
39
40 try:
41 ## Parameters setting
42 port = 1 ## Depend on your device
43 ch0 = 0
44 ch1 = 1
45 timeout = 3 ## [sec]
46
47 ## Get firmware model & version
48 driver_info = dev.Sys_getDriverInfo(timeout)
49 print(f"Model name: {driver_info[0]}, Firmware version: {driver_info[-1]} ")
50
51 ## Open thermo
52 err = dev.Thermal_open(port, timeout)
53 print(f"Thermal_open: {err}")
54
55 ## Set thermo port and get status in channel 0
56 status = dev.Thermal_getStatus(port, ch0, timeout)
57 print(f"Thermal_getStatus in channel {ch0}: {status}")
58
59 ## Set thermo port and get status in channel 1
60 status = dev.Thermal_getStatus(port, ch1, timeout)
61 print(f"Thermal_getStatus in channel {ch1}: {status}")
62
63 ## Close thermo
64 err = dev.Thermal_close(port, timeout)
65 print(f"Thermal_close: {err}")
66 except Exception as err:
67 pywpc.printGenericError(err)
68
69 finally:
70 ## Disconnect device
71 dev.disconnect()
72
73 ## Release device handle
74 dev.close()
75
76
77if __name__ == '__main__':
78 main()