Bird
0
0
Arduinoprogramming~5 mins

IR sensor for obstacle detection in Arduino - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What does an IR sensor detect in obstacle detection?
An IR sensor detects infrared light reflected from nearby objects to sense obstacles.
Click to reveal answer
beginner
How do you connect an IR sensor to an Arduino for obstacle detection?
Connect the IR sensor's VCC to 5V, GND to ground, and the output pin to an Arduino digital input pin.
Click to reveal answer
beginner
What Arduino function reads the IR sensor output?
Use digitalRead(pin) to read the sensor's output pin, which tells if an obstacle is detected.
Click to reveal answer
beginner
Why do we use an if statement with the IR sensor reading?
To check if the sensor output indicates an obstacle and then take action like stopping a motor.
Click to reveal answer
beginner
What is a simple Arduino code snippet to detect an obstacle using an IR sensor?
int sensorPin = 7; void setup() { pinMode(sensorPin, INPUT); Serial.begin(9600); } void loop() { int val = digitalRead(sensorPin); if (val == LOW) { Serial.println("Obstacle detected!"); } else { Serial.println("No obstacle."); } delay(500); }
Click to reveal answer
What does the IR sensor output when it detects an obstacle?
AHIGH signal
BAnalog voltage
CNo signal
DLOW signal
Which Arduino function reads a digital pin connected to an IR sensor?
AdigitalRead()
BpinMode()
CanalogRead()
DSerial.read()
What is the purpose of the delay() function in the IR sensor code?
ATo reset the sensor
BTo speed up sensor reading
CTo pause between readings for stability
DTo change sensor sensitivity
Which pin mode should be set for the IR sensor output pin on Arduino?
AINPUT
BANALOG
CINPUT_PULLUP
DOUTPUT
What happens if you connect the IR sensor output to an analog pin and use digitalRead()?
AIt reads LOW always
BIt may not read correctly
CIt works fine
DIt damages the Arduino
Explain how an IR sensor detects obstacles and how you use it with Arduino.
Think about how light bounces back and how Arduino reads that signal.
You got /5 concepts.
    Describe a simple Arduino program structure to detect obstacles using an IR sensor.
    Focus on the main parts of an Arduino sketch for sensor reading.
    You got /5 concepts.