All tutorials

2 · Inputs & sensors

Convert to volts (map & float)

Intermediate15 min

Goal

Turn the ADC's 0–1023 into a 0.00–5.00 V reading.

Why it matters

A raw reading means nothing: scaling is the heart of instrumentation.

Steps

  1. 01Read A0.
  2. 02Compute volts = value * 5.0 / 1023.0 (watch out for floats).
  3. 03Print with 2 decimals: Serial.println(volts, 2).

This tutorial runs inside the Circuitly simulator: your wiring and your code are checked automatically at every step.

Next tutorials