Skip to content

Instantly share code, notes, and snippets.

@szampardi
Created May 12, 2022 14:55
Show Gist options
  • Save szampardi/b732b47900ca8367e3e285333715e7ed to your computer and use it in GitHub Desktop.
Save szampardi/b732b47900ca8367e3e285333715e7ed to your computer and use it in GitHub Desktop.
#!/bin/bash -ex
_gpio="${1}"
_direction="${2:-out}"
if [[ ! -d /sys/class/gpio/gpio"${_gpio}" ]]; then
echo "${_gpio}" >/sys/class/gpio/export
fi
echo "${_direction}" >/sys/class/gpio/gpio"${_gpio}"/direction
echo "0" >/sys/class/gpio/gpio"${_gpio}"/value
sleep 4
echo "1" >/sys/class/gpio/gpio"${_gpio}"/value
echo "${_gpio}" >/sys/class/gpio/unexport
@szampardi
Copy link
Author

(4/out for SIM868 thingies)

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