我只想在Raspberry pi 3型号上打开一个带有pi-gpio的简单led。问题是,当我启动程序时,我收到如下错误:
root@raspberrypi:/node# node app.js
Error when trying to open pin 16
gpio-admin: could not flush data to /sys/class/gpio/export: Device or resource busy
/node/app.js:4
if(err) throw err;
^
Error: Command failed: /bin/sh -c gpio-admin export 23
gpio-admin: could not flush data to /sys/class/gpio/export: Device or resource busy
at ChildProcess.exithandler (child_process.js:751:12)
at ChildProcess.emit (events.js:110:17)
at maybeClose (child_process.js:1015:16)
at Socket.<anonymous> (child_process.js:1183:11)
at Socket.emit (events.js:107:17)
at Pipe.close (net.js:485:12)
root@raspberrypi:/node#
这是我的app.js
var gpio = require("pi-gpio");
gpio.open(16,"output",function(err){
if(err) throw err;
gpio.write(16, true, function(err){
if(err) throw err;
console.log("ouput on pin 16 ok");
});
});
我已尝试安装其他模块,例如rpi-gpio,但没有任何改变。