Engineering Code Lab · JavaScript in your browser
Code that measures, filters and controls.
32 short programming problems pulled straight from engineering: average a sensor, debounce a button, find a root, tune a PID loop, fit a calibration line. Each has starter code, automated tests (some hidden), hints that unlock one at a time, and an explanation once you solve it.
How the sandbox keeps you safe
- runs in your browserNever on a server.
- no networkThe sandbox cannot fetch, post or open sockets.
- 3 s limitInfinite loops are stopped, not frozen.
- nothing uploadedDrafts stay in this browser.
Level 1: Explorer
10 exercises also come as a buggy version to fix: guided debugging, the way real engineering often starts.
Levels describe what you can already do, not your age.
- ◇ L1 · SensorsAverage a sensorAdd up a list of temperature readings with a loop and divide to get the mean.loops🐞 debug variant
- ◇ L1 · SensorsFind the spikesScan a vibration log and report the positions of readings above a safe limit.loops and conditions
- ◇ L1 · SensorsMinimum, maximum, rangeTrack the lowest and highest readings in one pass and return them in an object.loops and objects🐞 debug variant
- ◇ L1 · ElectronicsOhm's law calculatorTurn volts and ohms into amps and watts, then print power with sensible units.functions
- ◇ L1 · SensorsADC counts to °CConvert a 10-bit analogue reading from a TMP36 temperature sensor into degrees Celsius.arithmetic
- ◇ L1 · ElectronicsSeries and parallel resistorsCombine a list of resistors in series and in parallel.loops over arrays
- ◇ L1 · PowerHow long will the battery last?Estimate a robot's runtime from battery capacity and load current, with a safety margin.functions and edge cases
How it works
- Write in the editor: Tab indents, Ctrl/⌘ + Enter runs.
- Run to see
console.logoutput, line charts fromplot(xs, ys, "label"), or a step-by-step sorting and searching visualiser. - Check to run the visible and hidden tests. Hidden tests show pass or fail, never the expected answer.
- Stuck? Hints unlock one at a time. Nothing is timed and nothing is ranked.