Q formats
Fractions stored in plain integers: Q8.8 in an int16_t, printing one with integers only, multiply then shift, divide with the shift first, and trading range for precision.
Open it in the simulatorFractions without a float unit, on an Uno and a knob: what floats really cost, Q formats, scaling, overflow guards, tables and fast trig. Ends with a fixed-point filter you tune and measure.
0 of 7 done
7 lessons in 4 chapters, about 5 hours on a simulated Arduino Uno R3. Free, in your browser, every step checked by the simulator.
Fractions stored in plain integers: Q8.8 in an int16_t, printing one with integers only, multiply then shift, divide with the shift first, and trading range for precision.
Open it in the simulatorWhat an int16_t does past 32767, and three guards: saturating adds, __builtin_add_overflow and checking before a multiply, on a knob-driven rocket speed.
Open it in the simulatorSine and cosine from a 65-entry quarter-wave table in Q1.14, with binary angles that wrap on their own, timed against sin() and flown as a satellite orbit.
Open it in the simulatorEach lesson opens when the one before it is done, and each chapter ends in a project.
Time what a float costs, then keep fractions in integers on purpose.
The Uno has no floating-point hardware. Time int, long and float multiplies with micros(), take off the loop overhead, and find where a float runs out of bits.
0 of 5 steps
Fractions stored in plain integers: Q8.8 in an int16_t, printing one with integers only, multiply then shift, divide with the shift first, and trading range for precision.
0 of 6 steps
Scale a knob to millivolts, and guard every sum against overflow.
Turn a 0 to 1023 knob reading into millivolts four ways: a 16-bit sum that wraps, a long divide, a float, and a multiply and shift, timed against each other.
0 of 5 steps
What an int16_t does past 32767, and three guards: saturating adds, __builtin_add_overflow and checking before a multiply, on a knob-driven rocket speed.
0 of 5 steps
Work it out once and look it up: gamma curves and a quarter-wave sine.
Gamma-correct an LED from a 33-entry table kept in flash with PROGMEM, time it against pow(), then interpolate between entries with integers only.
0 of 5 steps
Sine and cosine from a 65-entry quarter-wave table in Q1.14, with binary angles that wrap on their own, timed against sin() and flown as a satellite orbit.
0 of 6 steps
A fixed-point filter on a noisy knob, measured and tuned.
Smooth a noisy knob with an exponential moving average three ways, in float, in plain integers and in Q8, then measure the stall, the cost and the settle time, and tune it.
0 of 6 steps
All 7 lessons, in order, each with what it covers. Any of them opens in the editor right away.
Every lesson runs in the simulator with nothing to buy. When you want the real thing, these kits have the parts.
Pick the starter kit you own and run every lesson in its manual with the same parts on the same pins.
See every kitYes. All 7 lessons of Fixed-point and integer math are free and run in your browser, with nothing to install and no parts to buy before you start.
No. Every lesson runs on a simulated Arduino Uno R3 with its parts on the canvas, and the simulator checks each step as you go. When you want to build it for real, the same wiring and code work on a real board.
About 5 hours: 7 lessons in 4 chapters, each one a few short steps. Your progress is kept, so you can stop after any lesson and pick up where you left off.
Each chapter ends in a project that puts it together: Q formats, Overflow guards and Fast trig.
With "Why floats cost", and each lesson builds on the one before it. New to circuits? Electronics basics is the course that starts from zero.