# firmata-io

> Firmata protocol implementation

Latest version **2.3.0** (published 2020-11-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install firmata-io
pnpm add firmata-io
yarn add firmata-io
bun add firmata-io
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.3.0 |
| Published | 2020-11-17 |
| First published | 2019-01-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 75 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 712 |
| Author | Julian Gautier |
| Maintainers | rwaldron |

## Links

- npm: https://www.npmjs.com/package/firmata-io
- Repository: https://github.com/firmata/firmata.js
- Homepage: http://www.github.com/firmata/firmata.js
- Issues: https://github.com/firmata/firmata.js/issues
- npm.io page: https://npm.io/package/firmata-io

## Recent versions

- 2.3.0 (latest) — 2020-11-17
- 2.2.0 — 2020-01-06
- 2.0.0 — 2019-01-15

## README

# Firmata-io

This is Firmata.js without a default `Transport`.

# Install

Install Firmata-io:

```sh
npm install firmata-io --save
```

Install a Transport:


```sh
npm install serialport --save
```

## Transports

- Serialport
- Etherport

# Basic Usage

## With A _Transport Class_

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

```js
// Require your Transport!
const Serialport = require("serialport");
// Pass the Transport class to the transport binding
// function exported by firmata-io. The transport binding
// function will return the Firmata class object with
// the Transport class bound in its scope.
const Firmata = require("firmata-io")(Serialport);

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

  const board = new Firmata(port.path);

  board.on("close", () => {
    // Unplug the board to see this event!
    console.log("Closed!");
  });
});
```

## With A _Transport Instance_

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

```js
// Require your Transport!
const Serialport = require("serialport");
// Get the Firmata class without a bound transport.
const Firmata = require("firmata-io").Firmata;

Serialport.list().then(ports => {
  // Figure which port to use...
  const port = ports.find(port => {
    return port.manufacturer && port.manufacturer.startsWith("Arduino")
  });

  // Instantiate an instance of your Transport class
  const transport = new Serialport(port.path);

  // Pass the new instance directly to the Firmata class
  const board = new Firmata(transport);

  board.on("connect", () => console.log("Connected!"));

  board.on("close", () => {
    // Unplug the board to see this event!
    console.log("Closed!");
  });
});
```


## License

(The MIT License)

Copyright (c) 2011-2015 Julian Gautier <julian.gautier@alumni.neumont.edu>\
Copyright (c) 2015-2019 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.

---
_Source: https://npm.io/package/firmata-io · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
