> For the complete documentation index, see [llms.txt](https://dev.solid-run.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://dev.solid-run.com/marvell/a38x/sbc-platform/a388-other-articles/accessing-gpio-pins-on-clearfog-a388.md).

# Accessing GPIO Pins on ClearFog A388

**To control on the GPIO pins:**

* The external GPIOs are available under the /sys/class/gpio folder in Linux.
* To control on the GPIO pins you need to calculate the GPIO number XX and run the commands below:

```
# Export GPIO XX
echo XX > /sys/class/gpio/export

# Set GPIO pin Direction
echo "out" > /sys/class/gpio/gpioXX/direction
or
echo "in" > /sys/class/gpio/gpioXX/direction

# Set the value of an output pin
echo 1 > /sys/class/gpio/gpioXX/value
or
echo 0 > /sys/class/gpio/gpioXX/value

# Get the value of an input pin
cat > /sys/class/gpio/gpioXX/value

# Unexport GPIO XX
echo XX > /sys/class/gpio/unexport
```

This is an example code for accessing the GPIOs on the ClearFog Base/Pro:

```
#An example for gpio 22

# Export GPIO XX
cd /sys/class/gpio/ 
echo 22 > export 

cd gpio22/ 

# Set GPIO pin Direction
echo out > direction 

# Set the value of an output pin
echo 0 > value
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://dev.solid-run.com/marvell/a38x/sbc-platform/a388-other-articles/accessing-gpio-pins-on-clearfog-a388.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
