By the end of this section, you will gain experience in the following topics:
GPIO (General Purpose Input/Output) refers to pins used for general-purpose input and output operations in microcontrollers and development boards. These pins can be configured for both receiving digital data (input) and sending digital signals (output). Below is an example of an LED blink operation performed via GPIO pins on the Gemstone.

Todo: GPIO pins of the board

In addition to the materials listed on the Quick Start page, you will need an LED, a button, and a resistor.
1

GPIO Connections

Make the GPIO connections to the Gemstone board.
2

SSH/VNC Connection

Connect to the development board using either SSH or VNC.
3

Shell

Create Bash Shell scripts.

1. Turning on an LED

1.1. GPIO Connections

Connect the LED to GPIOX on the Gemstone, which is available for Input/Output, as shown below.

LED connection

1.2. Creating a Shell Script

After connecting to the Gemstone, create a script file for the LED blink operation.
touch led-blink.sh
Open the led-blink.sh file using the nano text editor in the terminal interface.
nano led-blink.sh
Copy and paste the following code into the led-blink.sh file.
#!/bin/bash

while :
do
    gpioset $(gpiofind GPIOX)=1
    sleep 1
    gpioset $(gpiofind GPIOX)=0
    sleep 1
done
Press CTRL+X, then Y to exit the nano editor and save the file.

1.3. Running the Shell Script

Make the led-blink.sh file executable using the chmod command.
chmod +x led-blink.sh
Run the led-blink.sh script.
./led-blink.sh
Finally, observe the LED blinking at 1-second intervals as shown in the video below.

LED blink application

2. Reading a Button and Turning on an LED

2.1. GPIO Connections

Connect the LED to GPIOX and the button to GPIOY on the Gemstone, as shown below.

LED and Button Connection

2.2. Creating a Shell Script

Create the script file.
touch button-led.sh
Open the button-led.sh file using the nano text editor in the terminal interface.
nano button-led.sh
Copy and paste the following code into the button-led.sh file. Press CTRL+X, then Y to exit the nano editor and save the file.

2.3. Running the Shell Script

Make the button-led.sh file executable using the chmod command.
chmod +x button-led.sh
Run the button-led.sh script.
./button-led.sh
Finally, observe the LED turning on while the button is pressed, as shown in the video below.

Turning on an LED with a button