Skip to main content

How to use?

Tiger computer is provided with some basic software examples which can be used as a starting point for developing custom programs.

The examples are available in:

  • C
  • Python
  • Bash

The examples are divided between categories:

  • External Interfaces‎
  • Internal Devices‎
  • Front Panel‎
  • TCX www

C examples

Examples written in C can be built with CMake. Put your source files into one folder and specify its name (${SRC_DIR} macro). Then create CMakeLists.txt file in the parent directory (example of this file is provided below).

cmake_minimum_required(VERSION 3.10)
project(examples)

function(link_gpiod target)
    target_include_directories(${target} PRIVATE ${GPIOD_INCLUDE_DIRS})
    target_link_libraries(${target} PRIVATE ${GPIOD_LIBRARIES})
endfunction()

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread -Wall")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Og -ggdb")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -I/usr/include/gpiod.h -lgpiod")

set(SRC_DIR c)

add_executable(BUZZER ${SRC_DIR}/BUZZER.c)
link_gpiod(BUZZER)
add_executable(DIO_Read ${SRC_DIR}/DIO_Read.c)
link_gpiod(DIO_Read)
add_executable(DIO_Write ${SRC_DIR}/DIO_Write.c)
link_gpiod(DIO_Write)
add_executable(DI_Read ${SRC_DIR}/DI_Read.c)
link_gpiod(DI_Read)
add_executable(EEPROM_Erase ${SRC_DIR}/EEPROM_Erase.c)
add_executable(EEPROM_Read ${SRC_DIR}/EEPROM_Read.c)
add_executable(EEPROM_SN_Read ${SRC_DIR}/EEPROM_SN_Read.c)
add_executable(EEPROM_Write ${SRC_DIR}/EEPROM_Write.c)
add_executable(ETHERNET ${SRC_DIR}/ETHERNET.c)
add_executable(FLASH_Erase ${SRC_DIR}/FLASH_Erase.c)
add_executable(FLASH_Read ${SRC_DIR}/FLASH_Read.c)
add_executable(FLASH_Write ${SRC_DIR}/FLASH_Write.c)
add_executable(GSM_RESET ${SRC_DIR}/GSM_RESET.c)
link_gpiod(GSM_RESET)
add_executable(LED ${SRC_DIR}/LED.c)
link_gpiod(LED)
add_executable(RTC ${SRC_DIR}/RTC.c)
link_gpiod(RTC)
add_executable(UIO_DI ${SRC_DIR}/UIO_DI.c)
link_gpiod(UIO_DI)
add_executable(UIO_AI_10V ${SRC_DIR}/UIO_AI_10V.c)
link_gpiod(UIO_AI_10V)
add_executable(UIO_AI_20mA ${SRC_DIR}/UIO_AI_20mA.c)
link_gpiod(UIO_AI_20mA)
add_executable(UIO_AO ${SRC_DIR}/UIO_AO)
link_gpiod(UIO_AO)
add_executable(JOYSTICK ${SRC_DIR}/JOYSTICK.c)
link_gpiod(JOYSTICK)
add_executable(USB ${SRC_DIR}/USB.c)
add_executable(OLED ${SRC_DIR}/OLED.c)
link_gpiod(OLED)
add_executable(ONEWIRE ${SRC_DIR}/ONEWIRE.c)
add_executable(RS232 ${SRC_DIR}/RS232.c)
add_executable(RS485 ${SRC_DIR}/RS485.c)
add_executable(DIP_Read ${SRC_DIR}/DIP_Read.c)
link_gpiod(DIP_Read)

In the parent directory create new folder named build, enter it and configure your project using:

cmake ..

Then build your project with:

cmake --build .

After that, executable files should appear in the same folder.

./file_name

Python examples

In order to execute Python files simply go to the desired directory and type:

python3 file_name.py

Bash examples

In order to execute Bash files simply go to the desired directory and type:

bash file_name.sh