我试图使用Node.js pi-gpio模块访问我的Raspberry pi上的gpio引脚,但是我收到以下错误: "Error when trying to open pin 11" "gpio-admin: could not flush data to /sys/class/gpio/ex[prt: device or resource busy" 我已经检查
"Error when trying to open pin 11" "gpio-admin: could not flush data to /sys/class/gpio/ex[prt: device or resource busy"
我已经检查了该目录,导出11或导出未导出我仍然得到相同的错误.
在这种情况下,这是我试图从Python转换为节点的代码,这里是审查的代码:
var gpio = require("pi-gpio");
function motor1(){
gpio.write(7, 1, function(err){
//if err
console.log("sent 1");
});
}
function motor2(){
gpio.write(11, 1, function(err){
console.log("sent...");
});
}
gpio.open(7);
gpio.open(11);
motor1();
motor2();
你还以前的会议开放吗?当我之前没有关闭它时,我遇到了同样的问题,
在您的motor1和2之后,在程序结束时尝试运行以下命令:
gpio.close(pin);
因为它们已经打开,所以在第一次运行时仍可能看到错误,因此请检查第二次运行
