0Pricing
Arduino & IoT Academy · Lesson

analogRead Returns 0–1023

Turn a voltage into a number you can use.

analogRead Returns 0–1023 is a free Arduino & IoT Academy lesson on CoddyKit — lesson 2 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Arduino & IoT Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

Turning Voltage into Numbers

Code cannot use raw volts directly. The analogRead function measures a pin and hands you back a plain number you can work with.

The Range Is 0 to 1023

Every analogRead result lands between 0 and 1023. That is exactly 1024 possible steps, from the lowest voltage to the highest.

Why 1024 Steps

The Uno uses a 10-bit converter, and 2 to the power of 10 is 1024. More bits would simply give you finer resolution.

0 Means Zero Volts

A reading of 0 means the pin sees 0V, the very bottom of the range. Nothing lower can be measured here.

1023 Means Full Voltage

A reading of 1023 means the pin is at the reference voltage, normally 5V on an Uno. That is the top of the scale.

Halfway Is About 512

Around 2.5V the value sits near 512, the middle of the range. The mapping from voltage to number is wonderfully linear.

Call It on an Analog Pin

Pass an analog pin name to read it. analogRead(A0) samples pin A0 and returns its current value as an int.

int value = analogRead(A0);

Store It in an int

The result fits easily in an int, since 1023 is small. Save it to a variable so you can use it later in your code.

int sensor = analogRead(A0);

No pinMode Needed

Analog inputs are ready out of the box. You do not call pinMode for them, you simply call analogRead when you want a value.

Convert Back to Volts

To see actual voltage, scale the reading. Multiply by 5.0 and divide by 1023 to turn the number into volts.

float v = analogRead(A0) * 5.0 / 1023.0;

Readings Wobble a Little

Tiny electrical noise makes values jiggle by a point or two. That is normal, and averaging a few reads smooths it out.

Quick Check

What does analogRead hand back to you?

Recap: The 0 to 1023 Scale

You learned analogRead turns a 0V to 5V signal into a number from 0 to 1023. Store it in an int, and scale it back to volts when needed.

Frequently asked questions

Is the “analogRead Returns 0–1023” lesson free?

Yes — the full text of “analogRead Returns 0–1023” is free to read here on the web, and the Arduino & IoT Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Arduino & IoT Academy course, upgrade to CoddyKit PRO.

What will I learn in “analogRead Returns 0–1023”?

Turn a voltage into a number you can use. You practise Arduino & IoT Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start Arduino & IoT Academy?

No prior experience is required. Arduino & IoT Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 2 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “analogRead Returns 0–1023” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this Arduino & IoT Academy lesson?

Yes. Every Arduino & IoT Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. Digital vs Analog Signals
  2. analogRead Returns 0–1023
  3. Read a Potentiometer Knob
  4. map() Values to a New Range
← Back to Arduino & IoT Academy