Socket
Socket
Sign inDemoInstall

board-io

Package Overview
Dependencies
1
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    board-io

Provides a standard interface to boards capable of IO (e.g. Arduinos, Maestros, Raspberry Pis, etc) and their firmware


Version published
Weekly downloads
597
decreased by-9.82%
Maintainers
1
Install size
91.1 kB
Created
Weekly downloads
 

Readme

Source

board-io

An extendable implementation of Johnny Five's IO Plugins.

Implements all required and optional methods, along with the required constants - MODE, HIGH, LOW, etc.

You should configure the relevant pins of your board in your constructor, then emit the ready event.

E.g.:

var util = require('util'),
  BoardIO = require('board-io');

MyIO = function(path, callback) {
  // call super constructor
  BoardIO.call(this);

  // .. configure pins
  this._pins.push(..);
  
  // wait for an async method or use proccess.nextTick to 
  // signal events
  process.nextTick(function() {
    // connect to hardware and emit "connect" event
    this.emit("connect");
  
    // all done, emit ready event
    this.emit("ready");
  
    // finally call the passed callback
    callback();
  }.bind(this));
}
util.inherits(IO, BoardIO);

Finally implement any of the IO Plugin methods of your choosing:

// implement digitalWrite
MyIO.prototype.digitalWrite = function(pin, value) {
  ..
};

Logging

By default BoardIO will print a message when every non-implemented method is invoked. To prevent this, set the quiet property of the super constructor args to true:

MyIO = function(path, callback) {
  // call super constructor
  BoardIO.call(this, {
    ..
    quiet: true
  });

  ..
}
util.inherits(IO, BoardIO);

Changelog

3.1.0

  1. Adds new i2cXXX methods
  2. Prints deprecation warning when calling old sendI2CXXX methods

3.0.0 - Initial release

  1. All Firmata methods stubbed out

Keywords

FAQs

Last updated on 18 Jan 2016

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc