Q8

Lesson 8 Quiz: Sensor-Controlled Outputs with Arduino

Test your understanding of using sensor values to control outputs like LEDs

32-Lesson Course • Semester 1

Quiz Instructions

  • This quiz covers material from Lesson 8: Sensor-Controlled Outputs with Arduino
  • Answer all questions to the best of your ability
  • Your responses will be emailed to your instructor for review
  • Take your time and think carefully about each answer
  • You can review the lesson material if needed before submitting

Student Information

Question 1: Sensor-Controlled Pattern

What is the correct pattern for using a sensor to control an output?

Question 2: Threshold Value

In the code if (sensorValue > 500), what does 500 represent?

Question 3: LED Control

If sensorValue = 700 and the code is if (sensorValue > 500) { digitalWrite(ledPin, HIGH); } else { digitalWrite(ledPin, LOW); }, what happens?

Question 4: pinMode for LED

What must you include in setup() to control an LED on pin 13?

Question 5: Multiple Thresholds

How can you create three response levels (Low, Medium, High) from a sensor reading?

Question 6: Functions with Sensors

What is a benefit of using functions like turnOnLED() and turnOffLED()?

Question 7: Loop with Sensor

What does this code do?
for (int i = 0; i < 5; i++) { sum += analogRead(sensorPin); delay(50); }

Question 8: Code Analysis

What does this line do?
int sensorValue = analogRead(sensorPin);

Question 9: Threshold Selection

Explain how you would choose a good threshold value for a light sensor that turns on an LED when it gets dark.

Question 10: Sensor-Controlled Project

Describe a sensor-controlled project you could build. What sensor would you use, what would it detect, and what output would it control?