JS Library to create projects / patches programatically

I just found XOD yesterday. Really awesome stuff.

I’ve been looking through the source code to see how things are done, and it’s realy amazing that some descriptions in a simple JSON (xodp) file can be assembled / converted / transpiled / compiled to be run directly on the arduino.

Has anyone written a JS library that will programatically create xodp JSON files / compile them using the CLI?

I was thinking it might work like this:

const xod = require('xod-js');

const led = xod.createNode({
  type: 'led', // aliased to xod/common-hardware/led
  attributes: {
    port: 'D11', // uses friendly names that map to the underlying identifiers
    brightness: '0.5',
  },
});

const patch = xod.createPatch();
patch.addNode(led);
xod.compile('arduino:avr:uno', patch); // generates xodp file based on patch and then sends output to compiler

Things would of course get more complex as new nodes and links get added.

Is there anything like this out there?

Did you take a look at https://github.com/xodio/xod/tree/master/packages/xod-project?

And for compilation, check out https://github.com/xodio/xod/tree/master/packages/xod-cli

1 Like