rwaldron/johnny-five — pull request #233 by achingbrain (2013-09-24 20:54:01+00:00)
Title: Use johnny-five with boards other than Arduino/Firmata

Johnny-Five is an awesome library, but I'd really like to be able to use the API to talk to boards that aren't Arduino/Firmata.

This pull request has two parts - the first is the main one. It removes the dependency on Firmata, instead inserting a [facade](https://npmjs.org/package/ioboard) that looks to the rest of the code just like Firmata. You can see the beginnings of such a facade [here](https://npmjs.org/package/pololu-maestro-ioboard).

To use the facade, you'd do this sort of thing:

```javascript
var five = require("johnny-five"),
MaestroIOBoard = require("maestro-ioboard");

var board = new five.Board({factory: MaestroIOBoard});
```

It's fully backwards compatible, so if you don't want to use the factory option, you can still use the no-args constructor:

```javascript
var five = require("johnny-five");

var board = new five.Board();
```

This will use the [firmata-ioboard](https://npmjs.org/package/firmata-ioboard) facade instead which is just a bunch of pass-throughs to firmata.

Alternatively you can still manually create a firmata instance and pass it in:

```javascript
var five = require("johnny-five"),
Firmata = require("firmata").board;

var firmata = new Firmata("/some/port", {}, function() {});
var board = new five.Board({firmata: firmata});
```

I did consider implementing the Firmata protocol for the Pololu Maestro, but sadly in order to send data back to the controlling computer, you need to use two serial ports (one for input and one for output) so it won't work with the firmata node module as it stands.

The second part of the pull request simply adds the ability to set LEDs on and off using the brightness method when you don't have them attached to a PWM pin. Instead it's treated as a digital output so passing brightness 0 turns the LED off and anything > 0 turns it on to full brightness.

Anyway, I'd love to know what you think.