# arduino-create-agent-helper

> Incomplete.

Latest version **1.0.0** (published 2017-07-17) · ISC license · 0 weekly downloads

## Install

```sh
npm install arduino-create-agent-helper
pnpm add arduino-create-agent-helper
yarn add arduino-create-agent-helper
bun add arduino-create-agent-helper
```

## 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 | 1.0.0 |
| Published | 2017-07-17 |
| First published | 2017-07-17 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | rakeshpai |

## Links

- npm: https://www.npmjs.com/package/arduino-create-agent-helper
- npm.io page: https://npm.io/package/arduino-create-agent-helper

## Dependencies (1)

- [socket.io-client](https://npm.io/package/socket.io-client.md) ^2.0.3

## Recent versions

- 1.0.0 (latest) — 2017-07-17

## README

Incomplete.

Example
---
Add your page to the allowed origins in the config.ini for Arduino Create agent:
```
origins = http://webide.arduino.cc:8080, http://localhost:3000
```

```javascript
const { isSupported, listPorts, open } = require('arduino-create-agent-helper');

isSupported().then(supported => {
  console.log("Create Agent found", supported);
  if(!supported) return;

  listPorts().then(ports => {
    console.log('Ports', ports);

    // Example:
    // [
    //   {
    //     "vendorId": "0x1a86",
    //     "path": "/dev/ttyUSB0",
    //     "productId": "0x7523",
    //     "isOpen": false
    //   }
    // ]

    open(ports[0].path, 9600).then(port => {
      console.log('Opened connection to', port);

      port.online = line => console.log('LINE:', line); // framed by newline
      // port.onmessage <- raw, without framing
      port.onclose = () => console.log('CLOSED');

      setTimeout(() => port.close(), 5000);
    });
  });
});
```

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