Skip to content

JS module providing discovery of the Arduino Create Plugin and communication with it

License

Notifications You must be signed in to change notification settings

eclipse1985/arduino-create-agent-js-client

 
 

Repository files navigation

License: GPL v3

arduino-create-agent-js-client

JS module providing discovery of the Arduino Create Plugin and communication with it

Installation

npm install arduino-create-agent-js-client --save

How to use

import Daemon from 'arduino-create-agent-js-client';

const daemon = new Daemon();

daemon.agentFound.subscribe(status => {
  // true / false
});

daemon.channelOpenStatus.subscribe(status => {
  // true / false
});

daemon.error.subscribe(err => {
  // handle err
});

// List available devices (serial/network)
daemon.devicesList.subscribe(devices => {
  const  serialDevices = devices.serial;
  const  networkDevices = devices.network;
});

// Open serial monitor
daemon.openSerialMonitor('port-name');

// Read from serial monitor
daemon.serialMonitorMessages.subscribe(message => {
  console.log(message);
});

// Write to serial monitor
daemon.writeSerial('port-name', 'message');

// Close serial monitor
daemon.closeSerialMonitor('port-name');

// Upload hex
daemon.upload(target, data);

// Upload progress
daemon.uploading.subscribe(upload => {
  console.log(status);
});

// Download tool
daemon.downloadTool('toolname', 'toolversion' 'packageName', 'replacement');

// Download status
daemon.downloading.subscribe(download => {
  console.log(download);
});

Development and test features

Just run npm run dev and open your browser on http://localhost:8000

Agent communication

To enable communication between your local installation and the Arduino Create Agent add origins = http://localhost:8000 on your agent config.ini file (if you are using https, add origins = https://localhost:8000).

  • On macOs ~/Applications/ArduinoCreateAgent-1.1/ArduinoCreateAgent.app/Contents/MacOS/config.ini
  • On Linux ~/ArduinoCreateAgent-1.1/config.ini

About

JS module providing discovery of the Arduino Create Plugin and communication with it

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 97.4%
  • HTML 2.6%