map() Values to a New Range
Rescale raw readings into useful units.
Raw Values Are Awkward
A 0 to 1023 reading rarely matches what you need. Often you want a percentage or an angle, not a raw sensor count.
Meet the map Function
The map function rescales a number from one range into another. It does the proportional math so you do not have to.
All lessons in this course
- Digital vs Analog Signals
- analogRead Returns 0–1023
- Read a Potentiometer Knob
- map() Values to a New Range