Skip to content

Instantly share code, notes, and snippets.

@heiher
Created March 31, 2020 13:40
Show Gist options
  • Save heiher/ad61c7468667d9dfc8fe5a61cef624c9 to your computer and use it in GitHub Desktop.
Save heiher/ad61c7468667d9dfc8fe5a61cef624c9 to your computer and use it in GitHub Desktop.
NAS外置硬盘盒开关程序(NanoPi侧)
#!/bin/bash
if [ ! -e /sys/class/gpio/gpio33 ]; then
echo 33 > /sys/class/gpio/export
sleep 0.1
echo out > /sys/class/gpio/gpio33/direction
fi
if [ ! -e /sys/class/gpio/gpio35 ]; then
echo 35 > /sys/class/gpio/export
sleep 0.1
echo out > /sys/class/gpio/gpio35/direction
fi
sleep 0.1
echo 1 > /sys/class/gpio/gpio35/value
sleep 0.01
echo 1 > /sys/class/gpio/gpio33/value
sleep 0.01
echo 0 > /sys/class/gpio/gpio33/value
sleep 0.01
echo 0 > /sys/class/gpio/gpio35/value
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment