Zig Practice
Learn Zig the way firmware is written: explicit integer widths and truncating division, switches over ranges, slices into a caller's buffer with no allocator, and one controller that turns a batch of raw sensor readings into a decision.
Values, Control Flow & Slices
Learn how to choose explicit integer widths, divide with truncation, switch over ranges, and pass slices through a caller's buffer with no allocator.
Sensor Units
Convert a 12-bit ADC reading into tenths of a degree Celsius by widening before multiplying, and into Fahrenheit tenths with signed division that truncates toward zero.
Alarm States
Band a reading into cold, normal, hot or critical with a switch over ranges, and find the longest consecutive run of readings in one state so a single noisy sample cannot sound the alarm.
Reading Window
Copy the most recent readings into a caller-owned buffer and return the filled part of it, and report the batch's lowest and highest reading as an optional.
Thermostat Controller
Turn one batch of raw ADC readings into a single cycle decision: current and average temperature, Fahrenheit, extremes, state, the recent window written into the caller's buffer, the heater call and the alarm.
Functions, Bytes & Text
Learn how to slice text into a caller's buffer with no allocator, exclusive-or bytes and read hex by hand, parse decimals into optionals, and compose all three into one report.
Sentence Fields
Split a GPS NMEA sentence into comma-separated slices of itself inside a caller's buffer, dropping the dollar and checksum suffix and keeping empty fields.
Checksum
Validate an NMEA sentence: exclusive-or the bytes it covers, read hex digits in either case, and reject a wrong or malformed checksum suffix.
Speed Readout
Read the GPS speed field as tenths by hand, reject anything malformed or oversized, convert knots to km/h with integer arithmetic and label it into a caller's buffer.
Fix Report
Summarise a batch of GPS sentences: corrupted counts, valid counts, whether the last RMC had a fix, the highest speed and the last speed labelled into a caller's buffer.
Frequently asked questions
4>What will I practice in this path?
2 modules: Values, Control Flow & Slices and Functions, Bytes & Text.
>How many challenges are there, and how hard are they?
8 challenges, all easy.
>What does this path run on?
Challenges run on Zig.
>Do I need to install anything?
No. Every challenge runs in a browser-based IDE with everything already set up, and your code is graded automatically against a test suite.
