3 · Outputs & actuators
Smooth fade (sine curve)
Advanced20 min
Goal
Make the fade look linear by using a non-linear curve.
Why it matters
The eye perceives light logarithmically: a linear ramp looks jerky.
Steps
- 01Sweep an angle from 0 to 2π.
- 02Compute val = (sin(angle) + 1) * 127.5.
- 03Send val to analogWrite().
This tutorial runs inside the Circuitly simulator: your wiring and your code are checked automatically at every step.