Socket
Book a DemoInstallSign in
Socket

arduino-create-agent-helper

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

arduino-create-agent-helper

Incomplete.

latest
npmnpm
Version
1.0.0
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

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
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);
    });
  });
});

FAQs

Package last updated on 17 Jul 2017

Did you know?

Socket

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