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

webjackport

v0.0.2

Published

A transport layer for firmata.js that makes use of WebJack.

Downloads

23

Readme

WebJack-Firmata

...is a wrapper for WebJack to use as transport layer for firmata.js. WebJackPort is inspired by EtherPort from Rick Waldron.

Try it out in this live demo: https://publiclab.github.io/webjack-firmata/example/

Note: WebJack is not stable yet, and WebJack-Firmata is neither. You may have to reload the demo site several times until you get an output in the 'Log' section.

Keyboard bindings

A second example, showing triggering of Arduino pins via keyboard keypresses, is available at https://publiclab.github.io/webjack-firmata/example/keyboard/

Install

npm install --save webjackport

Use

var Firmata = require("firmata").Board;
var WebJackPort = require("webjackport");
var board = new Firmata(new WebJackPort());

board.on("ready", function() {
  console.log("READY!");
  console.log(
    board.firmware.name + "-" +
    board.firmware.version.major + "." +
    board.firmware.version.minor
  );

  var state = 1;

  this.pinMode(13, this.MODES.OUTPUT);

  setInterval(function() {
    this.digitalWrite(13, (state ^= 1));
  }.bind(this), 500);
});

Also take a look at the demo site in the example folder.

Sketches

Three example sketches are provided:

  • SimpleDigitalFirmata
  • ConfigurableFirmata
  • StandardFirmataWebJack

SimpleDigitalFirmata and ConfigurableFirmata are capable of setting and reading digital pins. The first one is implemented with the standard Firmata library, the latter with ConfigureableFirmata.

StandardFirmataWebJack is a modification of the standard Firmata firmware and thus has all its capabilities. Additionally a custom SysEx command is implemented, that reports exactly one analog reading.

All sketches are configured with a 10 millisecond delay in the processing loop. This is due to crosstalk from requests messages. An immediate reply will make it difficult for WebJack to distinguish the crosstalk from the actual reply.

Known Issues

Currently, it is required to create the board with additional options:

var opts = {
  reportVersionTimeout: 2500,  // increase if no sound is played after loading the site
  skipCapabilities: true  // we skip this for now, reception via WebJack is not reliable enough
};
var board = new Board(new WebJackPort(), opts);

Audio cables may introduce crosstalk that can lead to reception of sent data. As a result of that, firmata can have difficulties to decode answers correctly. It can help to assign empty handler functions to SysEx requests as workaround:

board.sysexResponse(CAPABILITY_QUERY, function (data){});

##Developers

Help improve Public Lab software!

  • Join the '[email protected]' discussion list to get involved
  • Find lots of info on contributing at http://publiclab.org/wiki/developers
  • Review specific contributor guidelines at http://publiclab.org/wiki/contributing-to-public-lab-software

Building

webjackport.js is built using a Grunt task from the source files in /src/, and the compiled file is saved to /dist/webjackport.js. To build, run grunt build. To watch files for changes, and build whenever they occur, run grunt.

Building the demo

The demos in /example/ are bundled with Webpack. Before executing webpack, do npm install -- and cd example -- since you have to run webpack from inside the example directory. The code in /example/bundle.js, is then compiled from /example/Demo.js.