lego-blockly
A Blockly environment in the browser that drives LEGO interfaces from Interface A to LPF2. JavaScript with a little C++, installable as an app.
VLL support
It explicitly supports "Virtual Light Link (Code Pilot, MicroScout)" alongside Interface A/B, RCX/ControlMaster, WeDo, and LPF2.
VLL implementation (device/DeviceLegoVLL.js)
- Emitter = an LED on a serial control line via Web Serial → lego-blockly.
sendVLL(data7): preamble 1000 ms, start, 3 checksum bits + 7 data bits MSB-first, stop (ON 1u / OFF 3u).unit = 20 ms.- VLL checksum =
7-((n+(n>>2)+(n>>4))&7)— identical to the one used by Flash Force. - Opcodes are entered by the user (no built-in table); blocks:
vll_senddata,vll_preamblems,vll_unitms.
Send VLL to a Micro Scout (quick start)
- Open the live editor in Chrome/Edge (needs Web Serial). Wire a genuine FT232R/FT232H + red LED on the DTR pin — see lego-blockly.
- Pick the VLL (Code Pilot/MicroScout) device and Connect (Web Serial picker).
- Drop a
vll_senddatablock with a code from the VLL opcode table (e.g.0forward,4–8beeps,33Run,34Delete); tunevll_preamblems/vll_unitmsif needed. - Run — Highlight Execution shows the active block, Log shows what was sent.
Build a stored program = Delete (34) → script steps 16–32 → Run (33), same flow as Flash Force.
Other devices
Serial via USB-RS232 / HC-05 BT / BLE / WebSocket. SketchArduino/ is Interface A firmware.
Significance
A second implementation of the VLL frame, written from another codebase, and an emitter that is one diode on a serial control line.
Links
- Live editor (try it in the browser): blissca.github.io/lego-blockly
- github.com/BlissCA/lego-blockly
How it drives the light
The browser side is one call: Web Serial's port.setSignals({dataTerminalReady}) drives a serial control line high and low, and a diode on that line is the whole emitter. Edges are timed by busy-waiting on performance.now() rather than by setTimeout, which is why its 20 ms unit holds.
The same job can be done from Python instead of a browser, with vllftdi.py from JorgePe/mindstorms-vll. One trap: pass auto_detach=False, or it segfaults.