Sample Programs

We provide the basic usage and skill in the sample programs with source code.
Because the sample programs are made as simply as possible, you need to make good use of these for programming.

Folder structure

The following figure shows the structure of the folder in which COM-DRV(LNX) is installed.

User Directory/contec/comdrv
      |
      |________samples
                 |
                 |_______gcc                            gcc version samples
                 |
                 |_______python                       python version samples

List of sample programs

In the folder of each development language, sample programs are stored with the following configuration.

Development Language

Source File Name

Sample Name

gcc Samples

comread.c

Reading Sample

comsend.c

Sending Sample

comtest.c

Sending and Reading Test Sample

Python Samples

comwriteread.py

Sending and Reading Sample

 

How to compile C language samples

You can compile all the sample programs by executing the following command.

# cd contec/comdrv/samples/gcc

# make

 

Python language samples

Python is an interpreted programming language.
Therefore, there is no need to compile the source code beforehand.