2 Copyright (C) 2019 Moxa Inc. All rights reserved. 3 SPDX-License-Identifier: Apache-2.0 5 TC Python Sample Application 8 2019-02-11 William Chang Created it. 22 from ioThinx_4530
import ioThinx_4530_API
29 parser = argparse.ArgumentParser(description=
"TC sample program.")
30 parser.add_argument(
"-s",
"--slot", dest=
"tc_slot", type=int, default=7)
31 parser.add_argument(
"-c",
"--channel_start", dest=
"tc_channel_start", type=int, default=0)
32 parser.add_argument(
"-n",
"--channel_count", dest=
"tc_channel_count", type=int, default=2)
33 args = parser.parse_args()
35 tc_slot = args.tc_slot
36 tc_channel_start = args.tc_channel_start
37 tc_channel_count = args.tc_channel_count
38 print(
"TC slot = {}".format(tc_slot))
39 print(
"TC start channel = {}".format(tc_channel_start))
40 print(
"TC channel count = {}".format(tc_channel_count))
43 device = ioThinx_4530_API.ioThinx_4530_API()
46 tc_types = [TC_SENSOR_TYPE_K] * tc_channel_count
47 device.ioThinx_TC_Config_SetSensorTypes(tc_slot, tc_channel_start, tc_channel_count, tc_types)
50 device.ioThinx_IO_Config_Reload()
54 tc_values = device.ioThinx_TC_GetValues(tc_slot, tc_channel_start, tc_channel_count)
55 tc_statuss = device.ioThinx_TC_GetStatuss(tc_slot, tc_channel_start, tc_channel_count)
56 for i
in range(tc_channel_count):
57 print(
"[ {}:{}] value = {}, status = {}".format(tc_slot, tc_channel_start + i, tc_values[i], tc_statuss[i]))
58 if input(
"Press 'q' to exit. other keys to continue") ==
'q':
62 if __name__ ==
'__main__':