XOD Arduino Transpiler

raw JSON →
0.37.0 verified Fri May 01 auth: no javascript

Transpiles XOD projects into Arduino C++ code. Version 0.37.0 is the current stable release. Part of the XOD visual programming ecosystem, this package provides the core compilation pipeline: given a XOD project and an entry patch, it generates Arduino sketch code. Differentiators: tight integration with XOD's node-based paradigm, support for multiple Arduino boards, and optimized code generation for embedded targets. Release cadence is tied to XOD's overall release schedule.

error Error: Cannot find module 'xod-arduino'
cause Package not installed or not in node_modules.
fix
Run 'npm install xod-arduino xod-project' in your project directory.
error TypeError: transpileForArduino is not a function
cause Incorrect import style; using named import instead of default import.
fix
Use 'import transpileForArduino from 'xod-arduino' instead of '{ transpileForArduino }'.
error Error: Invalid entry point path. Must start with '@/'
cause Entry point path does not follow the required format.
fix
Provide a string like '@/main' where 'main' is a valid patch name.
gotcha The second argument 'entryPointPath' must be a string starting with '@/' indicating a patch path in the project. Incorrect paths cause runtime errors.
fix Ensure entryPointPath follows the exact patch path syntax, e.g. '@/main'.
deprecated Older versions (<0.30) accepted a different project format. Projects created with XOD <0.30 must be migrated.
fix Update to XOD 0.30+ and re-export the project.
gotcha The transpiler does not support all Arduino boards equally. Unsupported features may produce incomplete code.
fix Check the XOD documentation for board compatibility.
gotcha The transpiler expects a flat project structure. Nested patches may not be handled correctly.
fix Use only flat patch hierarchies or ensure all referenced patches are resolvable.
npm install xod-arduino
yarn add xod-arduino
pnpm add xod-arduino

Transpile a XOD project to Arduino C++ code using the default entry point.

import transpileForArduino from 'xod-arduino';
import { loadProject } from 'xod-project';

const project = loadProject('/path/to/project.xod');
const code = transpileForArduino(project, '@/main');
console.log(code);