Master Embedded Scripting with LSR
LSR is a robust interpreted language built in C++ specifically for ESP32 microcontrollers. Version 2.5 supports functions with arguments and call stacks, dynamic list collections, conditional branches, loops, and shorthand variable declarations.
Functions & Local Scopes
Define reusable blocks using function name(param) with dedicated call frame local variables and return handling.
List Array Collections
Store collections of numbers easily with syntax like list scores = [90, 85, 95]; and access elements dynamically.
ESP32 Flash & Watchdog
Engineered with a 5-second execution watchdog timer and fast symbol table lookups for optimal embedded microcontroller performance.
Complete Language Reference & Guides
Detailed documentation covering variables, functions, list arrays, conditions, and loops with copyable examples.
Shorthand Declarations & wrightv()
Declare variables instantly using shorthand keywords like gan hi = 2; or explicit types like gan num val = 42;. Output values and strings to the ESP32 Serial Monitor using wrightv().
- Automatic integer and string type inference
- String concatenation supported with
+operator
gan hi = 2;
wrightv(hi);
gan message = "Hello ESP32!";
wrightv(message);
function calculateArea(width, height) {
gan area = width * height;
wrightv("Calculated Area: " + area);
}
calculateArea(5, 10);
Defining Functions & Parameters
Organize your code into modular routines using function name(param1, param2). Functions maintain local execution scopes via call frames and support return statements.
- Pass multiple arguments separated by commas
- Local variables do not pollute global scope
List Arrays (list)
Store sequences of numeric values easily using bracket notation list name = [val1, val2];. Access individual elements dynamically using zero-based index syntax.
- Dynamic indexing like
scores[0] - Optimized for fast flash lookup
list scores = [90, 85, 95];
wrightv("First score:");
wrightv(scores[0]);
gan temperature = 35;
if (temperature >= 30) {
wrightv("Warning: High Temp!");
} else {
wrightv("Temp is safe.");
}
Conditional Branches (if / else)
Make decisions in your scripts using if (condition) { ... } else { ... } blocks supporting comparative operators like >=, <=, and ==.
For and While Loops (foras / whileas)
Execute repetitive tasks efficiently using foras (init; cond; update) and whileas (cond) block loops.
foras (gan i = 1; i <= 3; i = i + 1) {
wrightv("Loop count: " + i);
}
gan count = 2;
whileas (count > 0) {
wrightv("While item: " + count);
count = count - 1;
}
LSR Web Playground
Write, test, and execute LSR code live with syntax highlighting & smart keyword suggestions.
gan hi = 2; or function name()
UTF-8