JS module providing discovery of the Arduino Create Plugin and communication with it
npm install arduino-create-agent-js-client --save
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);
});
Just run npm run dev
and open your browser on http://localhost:8000
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