Skip to main content

How to use GPIO library

danger

this is a legacy library and thus not supported by Toradex anymore. We recommend that you use the new libraries for all Toradex modules. Please see the Toradex CE Libraries and Code Samples for up-to-date information.


This article aims to help the developer in using Toradex GPIO library in VC++. GPIO library is used to access general purpose input/output **(GPIO)** available on Toradex Computer Modules.

Use cases for GPIOs as output:

  • LEDs
  • Relays
  • and many more..

Use cases for GPIOs as input:

  • Detect switch status
  • Receive interrupt from external devices
  • and many more..

GPIO Library

  • We provide free GPIOLib including sample demo source code.
  • For general information on GPIO please refer this article

This application demonstrates the use of GPIO pin (SODIMM pin 101) as output to produce a 0.5Hz pulse.

  • Follow this tutorial up to step 9 to create a new VC++ project. Edit the code as follows:

  • To include GPIO library into project refer this article.

  • Build and deploy solution.

Demo application in C (GPIO as input / output)

Demo in Output configuration.


The following figure shows the output waveform.

Alternatively, you can use the GPIOConfig Tool.

On the Toradex GPIO Config window, click on Pin to sort the list by pin number. Scroll down to SFront.101.

The Level will change between 0 and 1 at the interval of 1 second.

Demo in Input configuration.

When Level changes from 0 to 1, it print message on console.

Download project

VS2008 ProjectVS20013 ProjectVS2015 ProjectModule compatibility
GPIO--PXA / Tegra
GPIOGPIOGPIOTegra / VFxx / iMX6
info

It is always recommended to update the libraries first before compiling the demo project. Click on this link to get latest libraries.



Send Feedback!