Lesson 70: Using analogReference()
Learn how analogReference() selects ADC reference mode and influences analogRead() scaling.
Lesson Template
Read sensors and control brightness with PWM output.
This lesson introduces the core ideas behind Analog I/O.
int sensor = analogRead(A0);
int pwm = map(sensor, 0, 4095, 0, 255);
analogWrite(2, pwm);Learn how analogReference() selects ADC reference mode and influences analogRead() scaling.
Learn how analogRead() samples sensors, what ADC resolution means, and how to map readings into usable values.
Learn how analogReadResolution() sets ADC bit depth, affects analogRead() output range, and when to change it.
Learn how analogWrite() controls PWM duty cycle, LED brightness, and variable-output behavior.
Learn how analogWriteResolution() changes PWM numeric range and improves control precision on supported boards.