-
Notifications
You must be signed in to change notification settings - Fork 0
Debug console
By clicking on the tray icon and going to the debug console you can try most of the websocket commands. The first command you should type in is:
log on
To get a json list of the connected boards you can issue the command:
list
You will receive an object of all the boards connected with USB or over the network:
{
"Ports":[
{
"Name":"/dev/ttyACM0",
"SerialNumber":"",
"DeviceClass":"",
"IsOpen":false,
"IsPrimary":false,
"Baud":0,
"BufferAlgorithm":"",
"Ver":"1.0.36",
"NetworkPort":false,
"VendorID":"0x2341",
"ProductID":"0x8036"
}
],
"Network":false
}{
"Ports":[
{
"Name":"192.168.1.101",
"SerialNumber":"",
"DeviceClass":"",
"IsOpen":false,
"IsPrimary":false,
"Baud":0,
"BufferAlgorithm":"",
"Ver":"1.0.36",
"NetworkPort":true,
"VendorID":"board=Arduino Y\\195\\186n Shield distro_version=0.1",
"ProductID":"Shield"
}
],
"Network":true
}To read input from a board connected to USB you must first open the port with the command
open /dev/ttyACM0 9600
where you should replace /dev/ttyACM0 with the actual port and 9600 with the baud.
You will receive a message like:
{
"Cmd":"Open",
"Desc":"Got register/open on port.",
"Port":"/dev/ttyACM0",
"IsPrimary":true,
"Baud":9600,
"BufferType":""
}or
{
"Cmd":"OpenFail",
"Desc":"Error opening port. Serial port busy",
"Port":"/dev/ttyACM0",
"Baud":9600
}You can then close the port with
close /dev/ttyACM0
You will receive a message like:
{
"Cmd":"Close",
"Desc":"Got unregister/close on port.",
"Port":"/dev/ttyACM0",
"Baud":9600
}or
{
"Error":"We could not find the serial port /dev/ttyACM0 that you were trying to close."
}While a port is open you can send input with
send /dev/ttyACM0 hello
with a reply like
{"Cmd":"Queued","QCnt":1,"Ids":[""],"D":["hello"],"Port":"/dev/ttyACM0"}
{"Cmd":"Write","QCnt":0,"Id":"","P":"/dev/ttyACM0"}
{"Cmd":"CompleteFake","Id":"","P":"/dev/ttyACM0"}You can receive output from the serial port by listening to messages like this:
{
"D":"output string\r\n"
}You can download a tool on the computer with a command like
downloadtool avrdude 6.0.1-arduino5 replace
receiving a reply like
{
"DownloadStatus": "Success",
"Msg":"Map Updated"
}The syntax of the command is:
downloadtool {{name}} {{version}} {{behaviour}}
where version can be a version number of the string "latest", and behaviour can be
"keep" (which skips the download if the tool already exists) and "replace" (which will download it again).
You can upload a binary sketch to a board connected to a port with a POST request to be made at the http endpoint.
The payload is a json object that looks like this:
{
"board":"arduino:avr:leonardo",
"port":"/dev/ttyACM1",
"commandline":"\"{runtime.tools.avrdude.path}/bin/avrdude\" \"-C{runtime.tools.avrdude.path}/etc/avrdude.conf\" {upload.verbose} -patmega32u4 -cavr109 -P{serial.port} -b57600 -D \"-Uflash:w:{build.path}/{build.project_name}.hex:i\"",
"signature":"HereGoesTheSignatureForStringAbove",
"hex":"HereGoesTheProgramHex",
"filename":"Blink.ino.hex",
"extra":{
"auth":{
"password":null
},
"wait_for_upload_port":true,
"use_1200bps_touch":true,
"network":false,
"params_verbose":"-v",
"params_quiet":"-q -q",
"verbose":true
}
}-
commandline is the command to execute to perform the upload. This is, for example, avrdude on a Leonardo.
-
hex contains the sketch hex encoded in base64
-
signature is the signature of the commandline signed with the private key that matches the public key contained in the config.ini of the arduino-create-agent
The results of the upload will be delivered via websocket with messages that look like:
{"Msg":"avrdude: verifying ...","ProgrammerStatus":"Busy"}
{"Msg":"avrdude done. Thank you.","ProgrammerStatus":"Busy"}
{"Flash":"Ok","ProgrammerStatus":"Done"}