Skip to content

Instantly share code, notes, and snippets.

@a2gs
Last active September 16, 2020 18:59
Show Gist options
  • Save a2gs/2f79fc9e68861d81f8ae9b1c25cb27e5 to your computer and use it in GitHub Desktop.
Save a2gs/2f79fc9e68861d81f8ae9b1c25cb27e5 to your computer and use it in GitHub Desktop.
Raspberry Pi GPIO
1) Exporting a PIN (example, 9):
echo "9" > /sys/class/gpio/export
(/sys/class/gpio/unexport to undo)
2) Setting PIN direction
echo "out" > /sys/class/gpio/gpio9/direction
3) Changing/reading PIN value:
echo "1" > /sys/class/gpio/gpio9/value
https://www.kernel.org/doc/Documentation/gpio/sysfs.txt
@a2gs
Copy link
Author

a2gs commented Sep 16, 2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment