X221, -LC, -AI
TECHNICAL REFERENCE MANUAL
VERSION: 1.4
Page 26 of 38
SECTION 9
Appendix B [GPIO]
9.1
GPIO control
This example shows how to set and readout GPIO 414.
For different GPIO numbers replace 414 accordingly.
9.1.1
Export GPIO
nvidia@nvidia-desktop:~$ echo 414 > /sys/class/gpio/export
nvidia@nvidia-desktop:~$
9.1.2
Change direction to in
nvidia@nvidia-desktop:~$ echo in > /sys/class/gpio/gpio414/direction
nvidia@nvidia-desktop:~$
9.1.3
Change direction to out
nvidia@nvidia-desktop:~$ echo out > /sys/class/gpio/gpio414/direction
nvidia@nvidia-desktop:~$
9.1.4
Set GPIO low
nvidia@nvidia-desktop:~$ echo 0 > /sys/class/gpio/gpio414/value
nvidia@nvidia-desktop:~$
9.1.5
Set GPIO high
nvidia@nvidia-desktop:~$ echo 1 > /sys/class/gpio/gpio414/value
nvidia@nvidia-desktop:~$
9.1.6
Readout GPIO value
nvidia@nvidia-desktop:~$ cat /sys/class/gpio/gpio414/value
0
nvidia@nvidia-desktop:~$ cat /sys/class/gpio/gpio414/value
1