npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

j5-rc-receiver

v0.0.4

Published

Nintendo RC Receiver component class plugin for Johnny-Five

Downloads

8

Readme

Receiver

Build Status

RC Receiver component plugin for Johnny-Five.

API & Documentation

Receiver

The Receiver class constructs objects that represent a single RC Receiver component.

var receiver = new Receiver();

receiver.on("change", function() {
  console.log(this.x, this.y);
});

Options

| Property | Type | Value(s)/Description | Default | Required | |------------|-----------|---------------------------- |---------|----------| | address | number | Address for I2C device * | 0x0A | no | | channels | number | Number of channels | 6 | no | | channels | array | Array of channel names ** | ** | no |

// Example of explicitly specified address
var receiver = new Receiver({
  address: 0x04
});

* The I2C address defaults to 0x0A, however digital pins 10 & 11 can be used to configure the address, according to the following table:

| D11 | D12 | Address | | --- | --- | ------- | | 0 | 0 | 0x0A | | 0 | 1 | 0x0B | | 1 | 0 | 0x0C | | 1 | 1 | 0x0D |

** The built-in channel names are derived from the most commonly used names in the most common order:

  1. throttle
  2. aileron
  3. elevator
  4. rudder
  5. gear
  6. aux1
  7. aux2
  8. aux3

When channels: [...] are specified, the length is used to set the channel count and the names provided are used to override the above listed names.

Properties

| Property | Type | Value(s)/Description | |----------|-----------|---------------------------| | 1-n | number | Each channel value is accessible via numeric channel property. These are NOT zero-indexed|

Iterable/Iterator Protocol

For code running in Node.js 4.2.x or newer, Receiver objects implement the Iterable Protocol.

var receiver = new Receiver();

// Create a zero-indexed array of receiver's current values:
var array = Array.from(receiver);

Events

  • change Fired whenever any channel value changes.

  • change:[name] Fired whenever the channel matching [name] changes.

    receiver.on("change", function(change) {
      console.log("Channel(%d): %d", change.channel, change.value);
    });
    receiver.on("change:throttle", function(change) {
      console.log("Throttle: %d", change.value);
    });
  • data Fired as frequently as the hardware can be read.

Backpack Controller

Install Firmware

Using the Arduino IDE, install the firmware to your AVR based microcontroller of choice.

Assembly

RC Receiver, I2C Nano Backpack

Connect To I2C Capable Platform

Arduino UNO

RC Receiver, I2C Nano Backpack + Arduino Uno

var five = require("johnny-five");
var Receiver = require("j5-rc-receiver")(five);
var board = new five.Board();

board.on("ready", function() {
  var receiver = new Receiver();

  receiver.on("change", function(change) {
    console.log("Channel(%d): %d", change.channel, change.value);
  });
});

Tessel 2

RC Receiver, I2C Nano Backpack + Tessel 2

RC Receiver, I2C Mini Backpack + Tessel 2

var five = require("johnny-five");
var Receiver = require("j5-rc-receiver")(five);
var Tessel = require("tessel-io");
var board = new five.Board({
  io: new Tessel()
});

board.on("ready", function() {
  var receiver = new Receiver({
    // Tessel-IO allow omitting the bus when using Port A, 
    // but for illustrative purposes, we specify it here...
    bus: "A"
  });

  receiver.on("change", function(change) {
    console.log("Channel(%d): %d", change.channel, change.value);
  });
});

Intel Edison MiniBoard

RC Receiver, I2C Mini Backpack + Intel Edison MiniBoard

Intel Edison Arduino Board

RC Receiver, I2C Nano Backpack + Intel Edison Arduino Board

var five = require("johnny-five");
var Receiver = require("j5-rc-receiver")(five);
var Edison = require("edison-io");
var board = new five.Board({
  io: new Edison()
});

board.on("ready", function() {
  var receiver = new Receiver();

  receiver.on("pointermove", function() {
    console.log({ x: this.x, y: this.y });
  });
});

Flight Simulator

Coming soon?

NOTE

The examples shown here are provided for illustration and do no specifically indicate platform support. This component class is expected to work with any platform that has I2C support.