小编Sye*_*bal的帖子

出现错误EBUSY:资源忙或锁定

尝试运行Nodejs应用程序以测试Raspberry 3 B + Gpio Onoff模块,但是当我尝试运行该应用程序时遇到此错误

fs.js:114
throw err;

Error: EBUSY: resource busy or locked, write
at Object.writeSync (fs.js:568:3)
at Object.writeFileSync (fs.js:1199:26)
at new Gpio (/home/pi/Desktop/pitesting/node_modules/onoff/onoff.js:96:10)
at Object.<anonymous> (/home/pi/Desktop/pitesting/blink.js:3:7)
at Module._compile (internal/modules/cjs/loader.js:701:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
at Module.load (internal/modules/cjs/loader.js:600:32)
at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
at Function.Module._load (internal/modules/cjs/loader.js:531:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:754:12)
Run Code Online (Sandbox Code Playgroud)

这是我的应用代码

var onoff = require('onoff');
var Gpio = onoff.Gpio,
  led = new Gpio(4, 'out'),
  interval;
interval = setInterval(function () {
  var value = (led.readSync() + 1) % 2;
  led.write(value, function () {
    console.log("Changed …
Run Code Online (Sandbox Code Playgroud)

node.js npm raspberry-pi3

3
推荐指数
2
解决办法
3316
查看次数

标签 统计

node.js ×1

npm ×1

raspberry-pi3 ×1