Show Contents

# 4. Create a GPIO sample application

This tutorial helps you create, build, and launch the Digi APIX GPIO example. This application uses:

- A GPIO as input: Pin 7 of the GPIO connector (J30).
  To simulate a button press, connect the pin to GND.
- A GPIO as output: the User LED on the board.

The application toggles the LED whenever the button is pressed.

Before starting development for your ConnectCore platform, make sure your device is correctly connected, powered, and running. See Step 2: Set up the hardware and Step 3: Program the Yocto firmware.

Once your device is ready for development, follow these steps:

- 4.1. Create the project application
- 4.2. Build the project
- 4.3. Launch the application
- 4.4. Test the application

## 4.1. Create the project application

1. Select File > New > Project to open the New Project wizard
2. Select DEY sample project under the C/C++ category.
3. Click Next. The New DEY sample wizard opens.
4. Select the Digi APIX GPIO Sample application.
5. Click Finish to create the project.
   A new project called apix-gpio-sample appears in the Project Explorer view.

## 4.2. Build the project

1. Select the apix-gpio-sample project in the Project Explorer view.
2. Click the Build Active Configuration toolbar button .
   The build output appears in the Console view. The application binary is generated inside the project directory.

## 4.3. Launch the application

1. Select the apix-gpio-sample project in the Project Explorer view.
2. Right click and select Run As > DEY C/C++ Remote Application.
   The Connection dialog opens to allow you to select a connection to your device
3. Select the connection you have already created from the list.
4. Click OK. The application is automatically transferred to the device and executed.

## 4.4. Test the application

1. When the application is launched, the Terminal view is displayed asking you to press the button of your device.

>     [INFO] Testing interrupt blocking mode
>     Press the button (for 6 events):

3. Press the button on the board to toggle the User LED and see the output in the Terminal view.

>     [INFO] Testing interrupt blocking mode
>     Press the button (for 6 events):
>     Press 1; toggling output GPIO
>     Press 2; toggling output GPIO
>     Press 3; toggling output GPIO
>     Press 4; toggling output GPIO
>     Press 5; toggling output GPIO
>     Press 6; toggling output GPIO
>     [INFO] Testing interrupt asynchronous mode
>     Parent process will wait until 6 interrupts have been detected
>     Parent process: waiting ...
>     Input GPIO interrupt detected; toggling output GPIO
>     Input GPIO interrupt detected; toggling output GPIO
>     Input GPIO interrupt detected; toggling output GPIO
>     Input GPIO interrupt detected; toggling output GPIO
>     Input GPIO interrupt detected; toggling output GPIO
>     Input GPIO interrupt detected; toggling output GPIO
>     Input GPIO interrupt detected; toggling output GPIO
>     Input GPIO interrupt detected; toggling output GPIO
>     Parent process: no remaining interrupts. Test finished

You have successfully created and remotely launched applications in your ConnectCore platform. You can develop your own applications with Eclipse using Digi APIs to access the hardware interfaces available in your device, such as the SPI, I2C or ADC. See Digi APIX for Digi Embedded Yocto.

Note Eclipse with Digi plugins also facilitates the debug process. See Launch remote applications.

© 2018 Digi International Inc. All rights reserved.
4. Create a GPIO sample application updated on 22 January 2018 04:51:50 PM