Embedded Systems
A microcontroller’s pins are electric fingers you manage in software: pinMode sets the finger’s direction (will it push or will it feel?), digitalWrite/digitalRead sets its state. The Uno runs 5 V logic; one pin can push at most ~20 mA — always put a series resistor on an LED.
analogRead converts a continuous voltage into a number: the 10-bit ADC divides 0–5 V into 1024 steps (the staircase alongside). At 2.5 V you read ≈ 512; V = value·5/1023. A potentiometer’s wiper is the classic analog source.
analogWrite does NOT produce true analog: it outputs ~490 Hz PWM; the LED lets your eye — and the motor its inertia — feel the average. delay(), meanwhile, halts the processor entirely — to do several things at once you switch to the pattern of comparing timestamps with millis().
⚡ Open this lesson in the simulator — free