JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 20
  • Score
    100M100P100Q50599F
  • License ISC

NodeJS module to send and receive decimal codes through 433Mhz device on RaspberryPI 2

Package Exports

  • rpi-433

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (rpi-433) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

rpi-433

npm version

NPM

Simple NodeJS module to send and receive decimal codes through 433Mhz device on RaspberryPI 2

Dependencies

Building WiringPi

pi@raspberrypi ~ $ git clone git://git.drogon.net/wiringPi
...
pi@raspberrypi ~ $ cd wiringPi/wiringPi
pi@raspberrypi ~/wiringPi/wiringPi $ sudo su
...
root@raspberrypi:/home/pi/wiringPi/wiringPi# ./build

Installation

npm install rpi-433

Usage

Firstly, make sure you are running your application as root or with sudo, else the Raspberry Pi will not let you output/input to the GPIO and you'll get an error.

sudo node myscript.js

Please note that there are different and confusing ways to reference a channel. This module supports wPi schema. Once wiringPi is installed, in your CLI you can run gpio readall and check the wPi column or consult https://projects.drogon.net/raspberry-pi/wiringpi/pins/

gpio readall

Example

var rpi433    = require('rpi-433'),
    rfSniffer = rpi433.sniffer(2, 500), //Snif on GPIO 2 (or Physical PIN 13) with a 500ms debounce delay
    rfSend    = rpi433.sendCode;

// Receive    
rfSniffer.on('codes', function (code) {
  console.log('Code received: '+code);
});

// Send
rfSend(1234, 0, function(error, stdout) {   //Send 1234 through GPIO 0 (or Physical PIN 11)
  if(!error) console.log(stdout); //Should display 1234
});

/*
You can also use rfSend like that :

rfSend(code);
rfSend(code, pin);
rfSend(code, callback);
rfSend(code, pin, callback);
*/