Node.js driver for RF905 module
The NRF905 isn't a popular module for IoT applications: It's not the most efficient module and there's a lot more code to find for other modules like the NRF24L01. But the NRF905 offers superior range and as it happens I have quite a few of them lying around. Note that you have to run this as root as the RPIO package requires it to access the SPI.
var Nrf905 = require('./nrf905.js');
var radio = new Nrf905();
radio.init();
radio.setAddress([0x66, 0x66, 0x66, 0x66]);
Expects an array of 4 bytes
radio.attachReceivedCallback(function(err, payload) { console.log(payload); });
detach with detachReceivedCallback(function)
radio.startReceiveMode();
radio.stopReceiveMode();
radio.powerUp(); radio.powerDown();
Powering up takes 3 ms
radio.sendPacket([0x77, 0x77, 0x77, 0x77], "abcdefABCDEF");
First parameter is an array of 4 bytes of the destination address, second parameter the payload (up to 32 bytes, unchecked for now)
radio.writeConfig([offset], [configarray])
Please refer to the NRF905 datasheet to get more information on how to configure this module.
radio.readConfig()
Returns a string with the config array represented as HEX number, useful for debugging and testing.