Skip to content
Vasilis Georgitzikis edited this page Jul 24, 2013 · 16 revisions

Communication

Coming Soon™

Request

There are 4 main keys in the JSON request body:

  • files
  • format
  • version
  • build

files

files contains an array of the files to be compiled, with one record for each file. Each file is represented as a key-value array itself, with the filename key containing the filename and the content key containing the code.

For example, to represent a single file named myfile and containing the code printf(300);, its representation would be:

{"filename":"myfile","content":"printf(300);"}

and the files key would contain:

[{"filename":"myfile","content":"printf(300);"}]

format

format contains the output format you would like to request from the compiler. The valid options are:

  • syntax - performs a syntax check only. used for "Verify".
  • object - returns an object file (.o) for your code on success
  • binary - returns a base64-encoded binary file for the target device on success
  • elf - returns an ELF (.elf) binary file on success
  • hex - returns a hex-encoded (.hex) binary file for the target device on success

version

version contains the Arduino SDK version that your code will be built with. Valid options are 100, 101, 102, 103, 104 and 105 for Arduino versions 1.0.0-1.0.5 respectively.

build

last but not least, build contains the build parameters for the selected board configuration, which the ones found in the original boards.txt configuration files under the board_name.build.* parameters. The parameters you need to specify are:

  • mcu - processor's MCU spec
  • f_cpu - processor's clock speed F_CPU spec
  • core - Arduino core used for the board
  • variant - variant used for the board
  • vid - USB VID (optional, for Leonardo-like USB-enabled devices)
  • pid - USB VID (optional, for Leonardo-like USB-enabled devices)

Example

Here's an example of the JSON request for verifying (syntax check) a 2-file sketch for Arduino UNO.

{
   "files":[
      {
         "filename":"hello.h",
         "content":"#define HELLO"
      },
      {
         "filename":"hello.ino",
         "content":"void setup()\n{\n\tint bla, blabla = 5;\n}\n\nvoid loop()\n{\n\n}\n"
      }
   ],
   "format":"syntax",
   "version":"105",
   "build":{
      "mcu":"atmega328p",
      "f_cpu":"16000000L",
      "core":"arduino",
      "variant":"standard"
   }
}

Response

Coming Soon™

Clone this wiki locally