1

Running as root user yet I'm still not permitted to use this:

echo "21" > /sys/class/gpio/export
echo "out" > /sys/class/gpio/gpio21/direction
echo "0" > /sys/class/gpio/gpio21/value
2
  • Could you cut and paste the system prompt, what you type in, and the system's response?
    – joan
    Commented Apr 17, 2014 at 21:47
  • I was able to get it to work after leaving it off for a few hours not sure why that would cause a change however
    – Ian
    Commented Apr 18, 2014 at 1:27

2 Answers 2

3

1) Check you are root:

id
uid=0(root) gid=0(root) groups=0(root),1001(indiecity)

2) Use more robust code to avoid typos, state conflicts etc:

pinon() {
    N=$1
    if [ ! -d /sys/class/gpio/gpio$N ] ; then
        echo "$N" > /sys/class/gpio/export
    fi
    echo "out" > /sys/class/gpio/gpio$N/direction
    echo "1" > /sys/class/gpio/gpio$N/value
}

pinon 21

3) Help us Help you by copy pasting the exact error message and the output of a few verification tests:

file /sys/class/gpio/gpio21
/sys/class/gpio/gpio21: ERROR: cannot open `/sys/class/gpio/gpio21' (No such file or directory)

etc, if you edit your question to make it more answerable people will up-vote instead of down-vote it.

4) Although you are not able to reproduce this issue please select an answer to close the question.

1
sudo su
echo 21 > /sys/class/gpio/export
cd /sys/class/gpio/gpio21
echo out > direction
echo 0 > value
2
  • You should expand on your answer and explain why this will work and how it differs from what the OP did. Commented Apr 14, 2015 at 7:38
  • Your post is the same as the OPs example, likely the OP tried double exporting, try offering a more robust solution. Commented Apr 16, 2015 at 4:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.