Lesson Template

Analog I/O

Read sensors and control brightness with PWM output.

Progress

12% completed

Lesson Overview

This lesson introduces the core ideas behind Analog I/O.

  • analogRead()
  • PWM
  • Mapping ranges

Example Code

int sensor = analogRead(A0);
int pwm = map(sensor, 0, 4095, 0, 255);
analogWrite(2, pwm);

Lessons in This Section

Lesson 70: Using analogReference()

Learn how analogReference() selects ADC reference mode and influences analogRead() scaling.

Open Lesson

Lesson 68: Using analogRead() for Analog Input

Learn how analogRead() samples sensors, what ADC resolution means, and how to map readings into usable values.

Open Lesson

Lesson 69: Using analogReadResolution()

Learn how analogReadResolution() sets ADC bit depth, affects analogRead() output range, and when to change it.

Open Lesson

Lesson 71: Using analogWrite() for PWM Output

Learn how analogWrite() controls PWM duty cycle, LED brightness, and variable-output behavior.

Open Lesson

Lesson 72: Using analogWriteResolution()

Learn how analogWriteResolution() changes PWM numeric range and improves control precision on supported boards.

Open Lesson