Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Board #285

Closed
aronvandervalk opened this issue Jan 13, 2022 · 5 comments
Closed

Board #285

aronvandervalk opened this issue Jan 13, 2022 · 5 comments

Comments

@aronvandervalk
Copy link

aronvandervalk commented Jan 13, 2022

Hi!

I'm trying to get my Pi fired up with the node-pixel library, together with I2C backpack.
I installed the packages and try to run this simple code:

var five = require("johnny-five");
var pixel = require("node-pixel");

var opts = {};
opts.port = process.argv[2] || "";

console.dir(process.argv[2]);

var board = new five.Board(opts);
var strip = null;

var fps = 20; // how many frames per second do you want to try?

board.on("ready", function() {
    console.log("Board ready, lets add light");
});

But I keep getting the result after running this code:
1642108712270 Board Looking for connected device
1642108720067 Board No connected device found

It seems it cannot find "node" as the board?

Also, when I try to log process.argv[2] I get an undefined, as it does not exists.

@ajfisher
Copy link
Owner

ajfisher commented Jan 13, 2022 via email

@aronvandervalk
Copy link
Author

Thanks for your answer! After installing the packages I tried running the code:

var five = require("johnny-five");
var Raspi = require("raspi-io").RaspiIO;
var board = new five.Board({
  io: new Raspi()
});

board.on("ready", function() {

    console.log("Board ready, lets add light");
});

Which keeps running into this error. Even after rebooting.

pi@raspberrypi:~/node-pixel-test $ node index.js
internal/fs/utils.js:269
    throw err;
    ^

Error: EACCES: permission denied, open '/sys/class/leds/led0/trigger'
    at Object.openSync (fs.js:462:3)
    at Object.writeFileSync (fs.js:1384:35)
    at new LED (/home/pi/node-pixel-test/node_modules/raspi-led/dist/index.js:37:18)
    at Object.createLED (/home/pi/node-pixel-test/node_modules/raspi-led/dist/index.js:62:16)
    at new LEDManager (/home/pi/node-pixel-test/node_modules/j5-io/dist/managers/led.js:32:30)
    at new J5IO (/home/pi/node-pixel-test/node_modules/j5-io/dist/index.js:116:32)
    at new RaspiIO (/home/pi/node-pixel-test/node_modules/raspi-io/dist/index.js:122:12)
    at Object.<anonymous> (/home/pi/node-pixel-test/index.js:5:7)
    at Module._compile (internal/modules/cjs/loader.js:999:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10) {
  errno: -13,
  syscall: 'open',
  code: 'EACCES',
  path: '/sys/class/leds/led0/trigger'
}

Do you have an idea what could cause this?

@ajfisher
Copy link
Owner

ajfisher commented Jan 14, 2022 via email

@aronvandervalk
Copy link
Author

Thanks for your answer. The sudo node index.js did the trick!

Thanks for helping me out! I appreciate it very, very much. Now I can start tinkering with your library and implementing some light installation ideas. Nice :-)

@ajfisher
Copy link
Owner

ajfisher commented Jan 15, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants