Skip to content

Commit

Permalink
README: more docs, clean up. Adds. AUTHORS.md
Browse files Browse the repository at this point in the history
  • Loading branch information
rwaldron committed Oct 24, 2018
1 parent 93658e6 commit ad3f363
Show file tree
Hide file tree
Showing 5 changed files with 149 additions and 677 deletions.
25 changes: 25 additions & 0 deletions AUTHORS.md
@@ -0,0 +1,25 @@
Rick Waldron
Julian Gautier
Glen Arrowsmith
Jeff Hoefs
Olivier Louvignes
Francis Gulotta
Luis Montes
Lars Toft Jacobsen
Érico
Jean-Philippe Côté
Ernesto Laval
Dustan Kasten
Lars Gregori
Andrey Bezugliy
Donovan Buck
Pravdomil
jywarren
Andrew Stewart
Richard Rodd
Dwayn Matthies
Sarah GP
achingbrain
David Resseguie
Nick Stewart
the1337guy
7 changes: 5 additions & 2 deletions packages/firmata-io/lib/firmata.js
Expand Up @@ -2325,6 +2325,11 @@ class Firmata extends Emitter {
*/

static requestPort(callback) {
if (!Transport || !Transport.list) {
process.nextTick(() => {
callback(new Error("No Transport provided"), null);
});
}
Transport.list(function(error, ports) {
const port = ports.find(port => Firmata.isAcceptablePort(port) && port);

Expand Down Expand Up @@ -2368,8 +2373,6 @@ class Firmata extends Emitter {

return decoded;
}


}

// Prototype Compatibility Aliases
Expand Down
39 changes: 33 additions & 6 deletions packages/firmata-io/readme.md
Expand Up @@ -28,6 +28,8 @@ npm install serialport --save

## With A Transport Class

Here's an example using the `Serialport` class:

```js
const Serialport = require("serialport");
const Firmata = require("firmata-io")(Serialport);
Expand All @@ -49,17 +51,15 @@ Firmata.requestPort((error, port) => {

## With A Transport Instance

Here's an example using a `Serialport` instance:

```js
const Serialport = require("serialport");
const Firmata = require("firmata-io").Firmata;

Firmata.requestPort((error, port) => {
if (error) {
console.log(error);
return;
}

Serialport.list().then(ports => {
// Figure which port to use...
const port = ports.find(port => port.manufacturer.startsWith("Arduino"));
const transport = new Serialport(port.comName);
const board = new Firmata(transport);

Expand All @@ -69,3 +69,30 @@ Firmata.requestPort((error, port) => {
});
});
```


## License

(The MIT License)

Copyright (c) 2011-2015 Julian Gautier <julian.gautier@alumni.neumont.edu>
Copyright (c) 2015-2018 The Firmata.js Authors (see AUTHORS.md)

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

0 comments on commit ad3f363

Please sign in to comment.