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
- Select File > New > Project to open the New Project wizard
- Select DEY sample project under the C/C++ category.
- Click Next. The New DEY sample wizard opens.
- Select the Digi APIX GPIO Sample application.
- Click Finish to create the project.
A new project called apix-gpio-sample appears in the Project Explorer view.
4.2. Build the project
- Select the apix-gpio-sample project in the Project Explorer view.
- 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
- Select the apix-gpio-sample project in the Project Explorer view.
- 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 - Select the connection you have already created from the list.
- Click OK. The application is automatically transferred to the device and executed.
4.4. Test the application
- 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):
- 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.