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

homestar-johnny-five

v0.0.15

Published

IOTDB Bridge for Arduino / JohnnyFive

Downloads

17

Readme

homestar-johnny-five

IOTDB Bridge for Arduino / JohnnyFive devices.

About

Installation

Then:

$ npm install homestar-johnny-five

Use

Blink an LED every two seconds

const iotdb = require("iotdb")
iotdb.use("homestar-johnny-five")

const things = iot.connect('JohnnyFiveLED', {
    pin: 2
});

let count = 0;
setInterval(function() {
    things.set(':on', count++ % 2)
}, 1000);

Technical

How does it interface with Johnny-Five

All the data referenced in this section refers to the "binding", which you can find in the of the model.js files.

Example Binding

We'll use this as a reference

exports.binding = {
    model: require('./Something.json'),
    bridge: require('../JohnnyFiveBridge').Bridge,
    discover: false,
    initd: {
        component: "Pin",
        pin: 13,
        type: "digital",
        model: 1,   // output
    },
    connectd: {
        data_out: function (paramd) {
            if (paramd.cookd.on !== undefined) {
                if (paramd.cookd.on) {
                    paramd.rawd.Pin = [ "write", 1 ];
                } else {
                    paramd.rawd.Pin = [ "write", 0 ];
                }
            }
        },
    },
};

Board

  • The "Board" is automatically created, doing the "best thing" for the current environment. For example, if you are on a Mac it will look to the serial port. If you're on an Edison, it will create an Edison parameter.
  • Right now we are only supporting a single board.
  • We may change / enhance this, but it won't break stuff already written

Component Creation

"binding.initd.component" determines which Johnny-Five component is being created. For example, if you want to use the Johnny-Five Pin component, this would be "Pin". All the other items in "initd" are passed to the constructor. So for example, this definition

initd: {
    component: "Pin",
    pin: 13,
    type: "digital",
    model: 1,   // output
}

ends up doing something like this

component = new five.Pin({
    pin: 13,
    type: "digital",
    model: 1,
})