Skip to content
Study Hall
← Unit 6: Computer Interfacing

TEJ3M · Unit 6 test review

Computer Interfacing: Test Review

Everything for the Unit 6 test on one page: the key facts from all 4 lessons, the mistakes that cost the most marks, and a practice test that points you back to the lessons you need.

Key facts

Microcontrollers and the Arduino

  • A microcontroller has CPU, memory and I/O on one chip and runs with no operating system.
  • setup() runs once at power-up; loop() runs forever.
  • Pin configuration goes in setup(); behaviour goes in loop().
  • An Uno pin can supply at most 40 mA, and all pins together at most 200 mA.
  • PWM is available only on pins 3, 5, 6, 9, 10 and 11.
  • Analog inputs A0–A5 report 0–1023 for 0–5 V.
  • Serial.begin(9600) plus Serial.println() is how you debug a sketch.

Digital Input and Output

  • An unconnected input floats and reads random values — every button needs a pull-up or pull-down resistor.
  • Pull-down: resistor to ground, button to 5 V, resting LOW. Pull-up: resistor to 5 V, button to ground, resting HIGH.
  • INPUT_PULLUP uses the chip's internal resistor, so pressed reads LOW.
  • 10 kΩ is the standard pull resistor value: defines the level firmly, wastes only 0.5 mA.
  • Switch bounce produces multiple transitions from one press — debounce in software or hardware.
  • delay() blocks everything; millis() lets you time without blocking.

Analog Inputs and Sensors

  • The Uno's ADC is 10-bit: levels, reported as 0–1023 across 0–5 V.
  • , and one step is about 4.9 mV.
  • Use 5.0 and 1023.0 in C, or integer division silently returns 0.
  • A resistive sensor needs a voltage divider, because an analog pin measures voltage, not resistance.
  • Choose the fixed resistor near the middle of the sensor's resistance range for maximum sensitivity.
  • A TMP36 gives 10 mV per °C with a 500 mV offset.
  • Never apply more than 5 V to an analog input.

PWM, Motors and Control Systems

  • PWM switches a digital pin rapidly; duty cycle sets the average voltage.
  • analogWrite(pin, value) takes 0–255. .
  • PWM is available only on pins 3, 5, 6, 9, 10 and 11 on an Uno.
  • A motor needs a transistor (for current) and a flyback diode (for the inductive spike).
  • An H-bridge reverses a motor; closing both switches on one side causes destructive shoot-through.
  • A servo reads pulse WIDTH: 1.0 ms = 0°, 1.5 ms = 90°, 2.0 ms = 180°, repeated every 20 ms.
  • Separate supplies must share a common ground.
  • Closed loop measures the result and corrects; open loop does not.

Where marks get lost

  • Putting pinMode() in loop() instead of setup(). (Microcontrollers and the Arduino)
  • Putting the program's actual behaviour in setup(), so it runs once and appears dead. (Microcontrollers and the Arduino)
  • Connecting a motor, relay or long LED strip directly to a pin. (Microcontrollers and the Arduino)
  • Using pins 0 and 1 for a project, which conflicts with USB uploading. (Microcontrollers and the Arduino)
  • Forgetting Serial.begin() and then wondering why the Serial Monitor is blank. (Microcontrollers and the Arduino)
  • Setting the Serial Monitor to a different baud rate than the sketch, which produces garbage characters. (Microcontrollers and the Arduino)
  • Powering a motor from the Arduino's 5 V pin, which browns out the board and resets it mid-program. (Microcontrollers and the Arduino)
  • Wiring a button with no pull resistor, producing an input that reads randomly. (Digital Input and Output)
  • Forgetting that INPUT_PULLUP inverts the logic — pressed reads LOW, not HIGH. (Digital Input and Output)
  • Not debouncing, so one press registers as several. (Digital Input and Output)
  • Using delay() in a sketch that must stay responsive to inputs. (Digital Input and Output)
  • Connecting a button between 5 V and ground with no resistor at all — a dead short when pressed. (Digital Input and Output)
  • Forgetting pinMode() in setup, leaving the pin in its default input state so digitalWrite seems to do nothing. (Digital Input and Output)
  • Using integer literals in the ADC conversion, so the result truncates to 0. (Analog Inputs and Sensors)
  • Connecting a resistive sensor directly to an analog pin with no divider — the pin cannot measure resistance. (Analog Inputs and Sensors)
  • Choosing a fixed resistor far from the sensor's range, giving a tiny usable output swing. (Analog Inputs and Sensors)
  • Forgetting the TMP36's 500 mV offset, which puts every reading 50 °C too high. (Analog Inputs and Sensors)
  • Applying more than 5 V to an analog pin. (Analog Inputs and Sensors)
  • Comparing a noisy reading against a single threshold with no hysteresis, so the output flickers. (Analog Inputs and Sensors)
  • Dividing by 1024 instead of 1023 — a small error, but the maximum reading maps to 5 V, not just below it. (Analog Inputs and Sensors)
  • Calling analogWrite an analog output. It is a square wave whose duty cycle you control. (PWM, Motors and Control Systems)
  • Using analogWrite on a pin without PWM — pins 3, 5, 6, 9, 10 and 11 only on an Uno. (PWM, Motors and Control Systems)
  • Driving a motor straight from a pin, destroying it. (PWM, Motors and Control Systems)
  • Omitting the flyback diode, so the inductive spike damages the transistor. (PWM, Motors and Control Systems)
  • Forgetting to connect the grounds of two separate supplies. (PWM, Motors and Control Systems)
  • Confusing a servo's pulse width with duty cycle. A servo reads the width of the pulse, not the fraction of the period. (PWM, Motors and Control Systems)
  • Powering a servo from the Arduino's 5 V pin, causing brownout resets that look like software crashes. (PWM, Motors and Control Systems)
  • Calling a timed motor run "closed loop" — without a sensor measuring the result, it is open loop. (PWM, Motors and Control Systems)

Practice test

24 questions from across the unit. Each one shows the lesson it comes from.

  1. Microcontrollers and the Arduino
    1
    Which function runs only once when an Arduino is powered on?
  2. Microcontrollers and the Arduino
    2
    What is the maximum current a single Arduino Uno pin should source, in milliamps?
    mA
  3. Microcontrollers and the Arduino
    3
    The Serial Monitor shows nothing while a sketch runs. What is the most likely cause?
  4. Microcontrollers and the Arduino
    4
    Why can't a 250 mA relay coil be driven directly from a digital pin?
  5. Microcontrollers and the Arduino
    5
    Match each Arduino feature to its description.
    Digital pins 0–13
    Pins 3, 5, 6, 9, 10, 11
    Pins A0–A5
    VIN
  6. Microcontrollers and the Arduino
    6
    A microcontroller has no operating system. What follows from that?
  7. Digital Input and Output
    7
    A button is wired between a pin and 5 V with no other components. What does the pin read when the button is NOT pressed?
  8. Digital Input and Output
    8
    What is the standard resistance value for a pull-up or pull-down resistor?
  9. Digital Input and Output
    9
    A counter increments several times from one button press. What is happening?
  10. Digital Input and Output
    10
    How much current flows through a 10 kΩ pull-down resistor when the pin is pulled to 5 V? Answer in milliamps.
    mA
  11. Digital Input and Output
    11
    Order the steps of a software debounce routine.
    1. 1Wait about 50 ms
    2. 2Act once, then wait for the button to be released
    3. 3Re-read the pin to confirm it is still LOW
    4. 4Detect the pin reading LOW
  12. Digital Input and Output
    12
    Match each function to what it does.
    pinMode(p, OUTPUT)
    digitalWrite(p, HIGH)
    digitalRead(p)
    millis()
  13. Analog Inputs and Sensors
    13
    analogRead() returns 512. What voltage is on the pin? Answer in volts to 2 decimal places.
    V
  14. Analog Inputs and Sensors
    14
    How many discrete levels can a 10-bit ADC distinguish?
    levels
  15. Analog Inputs and Sensors
    15
    In C, analogRead(A0) * 5 / 1023 gives 0 for most readings. Why?
  16. Analog Inputs and Sensors
    16
    A TMP36 outputs 750 mV. What temperature is that, in °C?
    °C
  17. Analog Inputs and Sensors
    17
    A sensor outputs up to 9 V. What must you do before connecting it to an analog pin?
  18. Analog Inputs and Sensors
    18
    What is the smallest voltage change an Uno's 10-bit ADC can detect across a 5 V range? Answer in millivolts, to 1 decimal place.
    mV
  19. PWM, Motors and Control Systems
    19
    What duty cycle does analogWrite(pin, 51) produce? Answer as a percentage.
    %
  20. PWM, Motors and Control Systems
    20
    Why is a flyback diode fitted across a motor?
  21. PWM, Motors and Control Systems
    21
    Which system is closed loop?
  22. PWM, Motors and Control Systems
    22
    What analogWrite() value gives a 40% duty cycle? Round to the nearest whole number.
  23. PWM, Motors and Control Systems
    23
    Order the elements of a closed-loop control system.
    1. 1The controller compares the set point with the measurement
    2. 2A sensor measures the result and feeds it back
    3. 3The actuator changes the output
    4. 4A set point is specified
  24. PWM, Motors and Control Systems
    24
    Match each component to its role in a motor circuit.
    Transistor
    Flyback diode
    H-bridge
    Common ground

Endless drill

Fresh numbers every time, for the calculation questions in this unit.

Endless drillnew numbers every time

Generating a problem…

Keep going