Analog & PWM Quiz
Analog & PWM Quiz
Test your knowledge of analogRead, analogWrite, and sensor wiring. — 6 questions
About the Analog & PWM Quiz
Test your knowledge of analogRead, analogWrite, and sensor wiring. This quiz has 6 multiple-choice questions. Each question has one correct answer, and you see an explanation straight after you answer, so you learn from every question — including the ones you get wrong. There is no time limit and nothing to sign up for; your answers are not stored.
The questions follow the material in the Analog Inputs & PWM on Arduino guide and the Analog & PWM Cheatsheet. Read them first if you want to prepare, or take the quiz cold to find the gaps in what you know.
Questions in this quiz
Preview the questions below. Each answer and its explanation are hidden until you choose to reveal them, so you can still take the quiz above without spoilers.
1. What range of values does analogRead() return on the Arduino Uno?
Show answer
Answer: C. 0 to 1023
The Uno's ADC is 10-bit, giving 2^10 = 1024 steps ߀” values from 0 to 1023 mapping to 0 V to 5 V.
2. Which of the following is a PWM-capable pin on the Arduino Uno?
Show answer
Answer: C. Pin 9
PWM pins on the Uno are 3, 5, 6, 9, 10, and 11. They are marked with ~ on the board.
3. What value should you pass to analogWrite() for approximately 50% duty cycle?
Show answer
Answer: C. 128
analogWrite() takes 0߀“255. Half of 255 ߉? 128 gives approximately 50% duty cycle.
4. What does map(512, 0, 1023, 0, 255) return?
Show answer
Answer: C. 127
map() rescales linearly. 512 is halfway through 0߀“1023, so the result is halfway through 0߀“255, which is 127.
5. Which function would you use to prevent a value from going outside a valid range?
Show answer
Answer: B. constrain()
constrain(x, low, high) limits x to the range [low, high], returning low if x < low and high if x > high.
6. How many analog input pins does the Arduino Uno have?
Show answer
Answer: B. 6
The Uno has 6 analog inputs: A0 through A5. They can also be used as digital I/O pins.
How to use this quiz
- Answer every question before reading the explanations below — retrieving an answer from memory is what makes it stick.
- Note the questions you missed and revisit the matching section of the guide or cheatsheet.
- Retake the quiz a day or two later. Spaced repetition is one of the most reliable ways to remember technical details.