1/8
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai | Chat |
|---|
No analytics yet
Send a link to your students to track their progress
What is the range of an Arduino analog input?
0–1023
What is the range of Arduino PWM output using analogWrite()?
0–255
Why do we need to map an analog input to an output?
Because the input and output use different numerical ranges.
Input:
0–1023
Output:
0–255
map() converts one range into another.
What does this code do?
map(value, 0, 1023, 0, 255);It converts a value from the 0–1023 range into the equivalent value in the 0–255 range.
Why is the input range 1024 levels while the output range is 256 levels?
The input is 10-bit:
210=1024
The PWM output uses 8-bit values:
28=256
What is the relationship between 1024 and 256?
1024÷4=256
So, roughly speaking:
Output ≈ Input ÷ 4
when converting the ranges proportionally.
What happens when an input value of 0 is mapped from 0–1023 to 0–255?
0 → 0
What happens when 1023 is mapped from 0–1023 to 0–255?
1023 → 255
Approximately what does an input of 512 map to?
Approximately:
512 → 128