Found a workaround! Use the shell within node to export the pins. Works without root if the user is added to the gpio group, to do that execute sudo useradd -g pi gpio.
Setup the pins
const exec = require('child_process').exec;
exec("echo '22' > /sys/class/gpio/export", null);
exec("echo 'in' > /sys/class/gpio/gpio22/direction", null);
exec("echo '17' > /sys/class/gpio/export", null);
exec("echo 'out' > /sys/class/gpio/gpio17/direction", null);
Control the pins
gpio.setup('sys');
gpio.wiringPiISR(22, gpio.INT_EDGE_BOTH, function(delta) {
if (gpio.digitalRead(22) == 1) {
console.log("High");
gpio.digitalWrite(17, 1)
}
else if (gpio.digitalRead(22) == 0) {
console.log("Low");
gpio.digitalWrite(17, 0)
}
});