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
Darth Vader
  • 4,218
  • 24
  • 47
  • 70
knocte
  • 157
  • 1
  • 1
  • 8

1 Answers1

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?

The NetYeti
  • 566
  • 4
  • 6