- Main
- Tutorials
- Library
- Samples

- Namespace List
- Namespace Members

Functions | Variables
tc Namespace Reference

## Functions
def | main ()

## Variables
int | TC_SENSOR_TYPE_K = 1

## Detailed Description

    Copyright (C) 2019 Moxa Inc. All rights reserved.
    SPDX-License-Identifier: Apache-2.0

    TC Python Sample Application

    Date          Author            Comment
    2019-02-11    William Chang     Created it.

## Function Documentation

def tc.main | ( |  | ) |

Definition at line 26 of file tc.py.

26 def main():
27 parser = argparse.ArgumentParser(description="TC sample program.")
28 parser.add_argument("-s", "--slot", dest="tc_slot", type=int, default=7)
29 parser.add_argument("-c", "--channel_start", dest="tc_channel_start", type=int, default=0)
30 parser.add_argument("-n", "--channel_count", dest="tc_channel_count", type=int, default=2)
31 args = parser.parse_args()
32
33 tc_slot = args.tc_slot
34 tc_channel_start = args.tc_channel_start
35 tc_channel_count = args.tc_channel_count
36 print("TC slot = {}".format(tc_slot))
37 print("TC start channel = {}".format(tc_channel_start))
38 print("TC channel count = {}".format(tc_channel_count))
39
40 # initialize ioThinx I/O
41 device = ioThinx_4530_API.ioThinx_4530_API()
42
43 # temporarily set config
44 tc_types = [TC_SENSOR_TYPE_K] * tc_channel_count
45 device.ioThinx_TC_Config_SetSensorTypes(tc_slot, tc_channel_start, tc_channel_count, tc_types)
46
47 # reload config
48 device.ioThinx_IO_Config_Reload()
49
50 # get value
51 while True:
52 tc_values = device.ioThinx_TC_GetValues(tc_slot, tc_channel_start, tc_channel_count)
53 tc_statuss = device.ioThinx_TC_GetStatuss(tc_slot, tc_channel_start, tc_channel_count)
54 for i in range(tc_channel_count):
55 print("[ {}:{}] value = {}, status = {}".format(tc_slot, tc_channel_start + i, tc_values[i], tc_statuss[i]))
56 if input("Press 'q' to exit. other keys to continue") == 'q':
57 break
58
59
tc.main
def main()
Definition: tc.py:26
format
char const int const cJSON_bool format
Definition: cJSON.h:161

## Variable Documentation

int TC_SENSOR_TYPE_K = 1

Definition at line 23 of file tc.py.