rwaldron / johnny-five

JavaScript Robotics and IoT programming framework, developed at Bocoup.
http://johnny-five.io
Other
13.24k stars 1.76k forks source link

Supporting NRF24L01 #1819

Open Jenesius opened 1 year ago

Jenesius commented 1 year ago

I looked at the API provided by Johnny-five, but couldn't find any information on working with radios. Are there any examples of working with sensors like NRF24L01. In case I missed a mention of this in the documentation, please open my eyes. Thank you!

Jenesius commented 1 year ago
const five = require("johnny-five");
const NRF24 = require("nrf24");

const board = new five.Board();

board.on("ready", function() {
  const radio = new NRF24(this, {
    ce: 9,
    irq: 8,
    spi: {
      clock: 1000000,
      device: "/dev/spidev0.0"
    }
  });

  radio.begin();

  radio.printDetails(); 
});
dtex commented 1 year ago

@Jenesius Johnny-Five doesn't have support for the nRF24, and I doubt it ever will. Even the Nordic site recommends using Bluetooth for new projects.

I always hate when someone responds to a request like this with "You should use X instead", but in this case maybe there is a better option. Can I ask what you are trying to do?

Jenesius commented 1 year ago

@dtex Thnx for fast support! I want to connect two arduino pro mini using radios: drone and remote control. I check closed issues and dont found something that I can use like example to try repeat.

dtex commented 1 year ago

Since Johnny-Five requires a host computer running node, it's probably easier to have a radio (or bluetooth or wi-fi) connection to each Arduino in parallel rather than relaying from on Arduino to the next. To that end, Johnny-Five can be used in that scenario using serial over Radio, Bluetooth, or wi-fi. To be honest, that's not part of Johnny-Five, it's something that node-serialport supports. Johnny-Five doesn't care what the serial transport is.

I've used Xbee radios with Johnny-Five in the past and it worked well, but it's been years since I last tried it.