2

I connected a LED to pin 11 as per this guide. And this works in the terminal to turn it on and off:

gpio mode 0 out
gpio write 0 1
gpio write 0 0

But when I try to use pi-gpio, with this code as per this guide:

var gpio = require("pi-gpio");
gpio.open(11, "output", function(err) {     // Open pin 11 for output
    gpio.write(11, 1, function() {          // Set pin 11 high (1)
        gpio.close(11);                     // Close pin 11
    });
});

It gives this error message:

Error when trying to open pin 11
gpio-admin: failed to change group ownership of /sys/devices/virtual/gpio/gpio17/direction: No such file or directory

What's wrong with this? I have a Raspberry Pi 2 with Raspbian:

$ uname -a
Linux raspberrypi 4.1.7-v7+ #817 SMP PREEMPT Sat Sep 19 15:32:00 BST 2015 armv7l GNU/Linux
0

Hmm. Sounds like the install did not create the links for the libraries as expected. Try this answer: How to change gpio directory for node.js pi-gpio?

  • great, after applying the quick2wire-gpio-admin fix, it doesn't throw any errors, but it doesn't light up the LED :( – knocte Oct 20 '15 at 0:17
  • Can you try the same test on another PI? – growlf Nov 24 '15 at 20:32
  • @growlf could you include more detail in your answer, the link might answer the question, but if does not work at a later date your answer is useless – Darth Vader Apr 17 '16 at 9:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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