Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

License

NotificationsYou must be signed in to change notification settings

arduino/arduino-create-agent-js-client

Repository files navigation

License: GPL v3npm version

arduino-create-agent-js-client

JS module providing discovery of theArduino Create Agent and communication with it

Changelog

SeeCHANGELOG.md for more details.

Installation

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

How to use

importDaemonfrom'arduino-create-agent-js-client';constdaemon=newDaemon('https://builder.arduino.cc/v3/boards');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(({serial, network})=>{constserialDevices=serial;constnetworkDevices=network;});// Open serial monitordaemon.openSerialMonitor('port-name');// Read from serial monitor (ouputs string)daemon.serialMonitorMessages.subscribe(message=>{console.log(message);});// Read from serial monitor, output object with source port name/*  {    "P": "dev/ttyACM0",    "D":"output text here\r\n"  }*/daemon.serialMonitorMessagesWithPort.subscribe(messageObj=>{console.log(messageObj);});// Write to serial monitordaemon.writeSerial('port-name','message');// Close serial monitordaemon.closeSerialMonitor('port-name');// Upload sketch on serial target (desktop agent and chrome app)daemon.uploadSerial(target,sketchName,compilationResult,verbose);// Upload sketch on network target (daesktop agent only)daemon.uploadNetwork(target,sketchName,compilationResult);// Upload progressdaemon.uploading.subscribe(upload=>{console.log(status);});// Download tooldaemon.downloadTool('toolname','toolversion''packageName','replacement');// Download statusdaemon.downloading.subscribe(download=>{console.log(download);});

Version 2

Version 2 of the arduino-create-agent aims to provide a cleaner api based on promises.It will remain confined to a v2 property on the daemon object until it will be stable.At the moment it only supports tool management.

daemon.agentV2Found.subscribe(daemonV2=>{if(!daemonV2){// Your Agent doesn't support v2}// Your Agent supports v2});daemon.v2.installedTools().then(tools=>console.debug(tools))// [{"name":"avrdude","version":"6.3.0-arduino9","packager":"arduino"}]letpayload={name:'avrdude',version:'6.3.0-arduino9',packager:'arduino',url:'http://downloads.arduino.cc/tools/avrdude-6.3.0-arduino9-i686-w64-mingw32.zip',checksum:'SHA-256:f3c5cfa8d0b3b0caee81c5b35fb6acff89c342ef609bf4266734c6266a256d4f',signature:'7628b488c7ffd21ae1ca657245751a4043c419fbab5c256a020fb53f17eb88686439f54f18e78a80b40fc2de742f79b78ed4338c959216dc8ae8279e482d2d4117eeaf34a281ce2369d1dc4356f782c0940d82610f1c892e913b637391c39e95d4d4dfe82d8dbc5350b833186a70a62c7952917481bad798a9c8b4905df91bd914fbdfd6e98ef75c8f7fb06284278da449ce05b27741d6eda156bbdb906d519ff7d7d5042379fdfc55962b3777fb9240b368552182758c297e39c72943d75d177f2dbb584b2210301250796dbe8af11f0cf06d762fe4f912294f4cdc8aff26715354cfb33010a81342fbbc438912eb424a39fc0c52a9b2bf722051a6f3b024bd'}daemon.v2.installTool(payload)// Will install the tool in the system

Development and test features

Just runnpm run dev and open your browser onhttp://localhost:8000

Agent communication

To enable communication between yourlocal installation and theArduino Create Agentaddorigins = http://localhost:8000 on your agent config.ini file(if you are using https, addorigins = https://localhost:8000).

  • On macOs ~/Applications/ArduinoCreateAgent/ArduinoCreateAgent.app/Contents/MacOS/config.ini
  • On Linux ~/ArduinoCreateAgent/config.ini
  • On Windows C:\Users\[your user]\AppData\Roaming\ArduinoCreateAgent

About

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

Resources

License

Security policy

Stars

Watchers

Forks

Sponsor this project

  •  

Packages

No packages published

Contributors11


[8]ページ先頭

©2009-2025 Movatter.jp