You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is probably something pretty basic that i missed but would appreciate some help...
I suspect something to do with the pin numbering scheme, but i tried a few variations and still can't get it to work.
I'm on a Pi Zero W running buster:
$ uname -a
Linux neonpi 6.6.74+rpt-rpi-v6 #1 Raspbian 1:6.6.74-1+rpt1 (2025-01-27) armv6l GNU/Linux
i have a relay connected to BCM pin 17, physical pin 11.
I'm able to successfully toggle this using pinctrl from the command line, and it turns the relay on/off.
e.g.
$ pinctrl set 17 pu op # set to output with pull up
$ pinctrl set 17 dh # drive high
$ pinctrl set 17 dl # drive low
However the node program below yields
1.6.3
/home/pi/poolServer/blink.js:8
line.requestOutputMode();
^
Error: EBUSY, Device or resource busy
at Object.<anonymous> (/home/pi/poolServer/blink.js:8:6)
at Module._compile (node:internal/modules/cjs/loader:1241:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1295:10)
at Module.load (node:internal/modules/cjs/loader:1091:32)
at Module._load (node:internal/modules/cjs/loader:938:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:83:12)
at node:internal/main/run_main_module:23:47 {
errno: 16,
code: 'EBUSY',
syscall: '::requestOutputMode'
Code:
const { version, Chip, Line } = require("node-libgpiod");
global.chip = new Chip(0);
const pin = 17;
global.line = new Line(chip, pin); // relay on GPIO17
let count = 10;
console.log(version());
line.requestOutputMode();
const blink = () => {
if(count){
line.setValue(count-- % 2);
console.log("set pin", pin, "to", count % 2 );
setTimeout(blink,1000);
} // else line.release();
// not needed, libgpiod releases resources on process exit
};
setTimeout(blink,1000);
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
This is probably something pretty basic that i missed but would appreciate some help...
I suspect something to do with the pin numbering scheme, but i tried a few variations and still can't get it to work.
I'm on a Pi Zero W running buster:
$ uname -a
Linux neonpi 6.6.74+rpt-rpi-v6 #1 Raspbian 1:6.6.74-1+rpt1 (2025-01-27) armv6l GNU/Linux
i have a relay connected to BCM pin 17, physical pin 11.
I'm able to successfully toggle this using pinctrl from the command line, and it turns the relay on/off.
e.g.
However the node program below yields
Code:
Beta Was this translation helpful? Give feedback.
All reactions