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