{"id":26981,"library":"fastled","title":"FastLED Wasm Compiler","description":"A Python library that compiles Arduino sketches using the FastLED library to WebAssembly, enabling LED animations in the browser. Current version is 2.0.6, with a recent major version bump from 1.x to 2.x. Release cadence is irregular, with active development on GitHub.","status":"active","version":"2.0.6","language":"python","source_language":"en","source_url":"https://github.com/zackees/fastled-wasm","tags":["fastled","wasm","arduino","led-animations","webassembly"],"install":[{"cmd":"pip install fastled","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"note":"In v2.x, the main entry point changed. The old import path from v1.x no longer works.","wrong":"from fastled.compiler import compile_wasm","symbol":"compile_wasm","correct":"from fastled import compile_wasm"},{"note":"Alternative class-based API for v2.x. Ensure you use the correct class name.","wrong":null,"symbol":"FastLEDWasm","correct":"from fastled import FastLEDWasm"}],"quickstart":{"code":"from fastled import compile_wasm\n\nsketch_code = '''\n#include <FastLED.h>\n#define NUM_LEDS 60\n#define DATA_PIN 2\nCRGB leds[NUM_LEDS];\nvoid setup() { FastLED.addLeds<WS2812, DATA_PIN, GRB>(leds, NUM_LEDS); }\nvoid loop() { fill_solid(leds, NUM_LEDS, CRGB::Red); FastLED.show(); delay(100); }\n'''\n\nwasm_bytes = compile_wasm(sketch_code, target='web')\nprint(f'Compiled WASM size: {len(wasm_bytes)} bytes')","lang":"python","description":"Compile a simple FastLED sketch to WebAssembly. The `target` parameter can be 'web' or 'cli'."},"warnings":[{"fix":"Update imports to `from fastled import compile_wasm` and adjust function calls accordingly.","message":"Major version 2.0.0 introduced breaking changes: the `compile_wasm` function replaces the old `FastLEDWasm` class-based API from v1.x. Old code using `from fastled.compiler import compile_wasm` will break.","severity":"breaking","affected_versions":"<2.0.0"},{"fix":"Always pass `target='web'` or `target='cli'` to avoid ambiguity.","message":"The `target` parameter must be explicitly specified when calling `compile_wasm`. Default is 'web', but omitting it may lead to unexpected output.","severity":"gotcha","affected_versions":">=2.0.0"},{"fix":"Install Emscripten SDK (emsdk) and ensure `emcc` is in PATH. See https://emscripten.org/docs/getting_started/downloads.html","message":"Compilation requires a C++ compiler toolchain (e.g., Emscripten) to be installed. The library does not bundle these; missing tools lead to obscure errors.","severity":"gotcha","affected_versions":"All"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Use `from fastled import compile_wasm`.","cause":"In v2.x, the import path changed. The old `fastled.compiler` module no longer exists.","error":"ImportError: cannot import name 'compile_wasm' from 'fastled.compiler'"},{"fix":"Install Emscripten: `git clone https://github.com/emscripten-core/emsdk.git` then `cd emsdk && ./emsdk install latest && ./emsdk activate latest && source ./emsdk_env.sh`.","cause":"The library requires Emscripten SDK to compile C++ to WebAssembly, but it's not installed or not in PATH.","error":"RuntimeError: emcc not found. Please install Emscripten and add it to PATH."}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}