lcd.setCursor(5, 0);
lcd.print("Hi");
Where will “Hi” begin?
At column 6 of the first row.
for (int i = 1; i <= 5; i++) {
Serial.println(i);
}
What will be printed, and why is 5 included?
1
2
3
4
5
In your automatic gate activity, the requirement says that when an object is detected within 30 cm, the gate should remain closed and all LEDs should turn ON.
If the detected distance is 25 cm, what should the system do?
The gate should remain closed, and all LEDs should be ON because 25 cm is within the 30 cm condition.
You want the buzzer to activate only when an object is 10 cm or closer. Write the condition.
if (distance <= 10)
The Arduino needs to send information TO the RC522. Which communication line is responsible according to the lesson: MOSI or MISO?
MOSI, because it sends data from Arduino → RC522
Your LDR readings are changing correctly in the Serial Monitor, but the LED never changes. What does this suggest?
The sensor is probably being read correctly, so the problem may be in the condition, LED wiring, LED pin definition, or output code.
for (int i = 0; i < 3; i++) {
Serial.println("Hello");
}
How many times will “Hello” print, and why?
Three times, for i = 0, 1, and 2. When i becomes 3, i < 3 is false.
if (distance < 15) {
digitalWrite(led, HIGH);
} else {
digitalWrite(led, LOW);
}
What happens when an object moves from 20 cm to 10 cm away?
At 20 cm the LED is OFF. At 10 cm the condition becomes true, so the LED turns ON.
if (distance < 30) {
gate.write(90);
} else {
gate.write(0);
}
What happens at exactly 30 cm?
The else runs, so the gate moves to 0°, because 30 is not less than 30.
What is the main difference between an RFID reader and an RFID tag/card?
The RC522 is the reader that detects information, while the RFID tag/card contains information that the reader can detect.
if (buttonState == HIGH) {
// A
} else {
// B
}
Section else, because the if condition is false.
digitalWrite(red, HIGH);
delay(3000);
digitalWrite(green, HIGH);
What is wrong if the goal is to change from red to green?
The red LED was never turned OFF, so both red and green will be ON.
if (score >= 90) {
Serial.println("Excellent");}
else if (score >= 75) {
Serial.println("Passed");}
else {
Serial.println("Needs Improvement");}
If score = 95, will Arduino print both “Excellent” and “Passed” since 95 satisfies both conditions? Explain.
No. It prints only “Excellent.” Once the first if condition is true, Arduino executes that block and skips the remaining else if and else blocks.
A student removes delay() from a buzzer-and-LED sequence that is supposed to blink slowly. What is likely to happen
The Arduino executes the changes extremely quickly, so the intended blinking/timing may not be noticeable.
If x = 20, what happens to its value after x -= 5?
It becomes 15. x -= 5 means x = x - 5
servo.write(0);
delay(2000);
servo.write(90);
Describe what the servo does.
It moves toward 0°, waits 2 seconds, then moves toward 90°.
What symbol is used to create a single-line comment in C/C++?
//
Servo gate;
void setup() {
gate.write(90);
}
An important setup instruction is missing before controlling the servo. What is it?
An important setup instruction is missing before controlling the servo. What is it?
The RC522 has information that needs to be sent BACK to the Arduino. Which line is used?
MISO, because it sends data from RC522 → Arduino.
If a condition uses ||, and the first condition is false but the second condition is true, what is the final result? Why?
True, because || means OR. Only one condition needs to be true.
What does \n mean in programming?
New line. It moves the next output to the next line.
gate.write(0);
gate.write(90);
gate.write(180);
What is the difference between these commands?
They command the servo to move to different positions: 0° = fully closed, 90° = middle position, and 180° = fully open, according to the lesson.
digitalWrite(green, HIGH);
delay(5000);
digitalWrite(green, LOW);
digitalWrite(yellow, HIGH);
delay(2000);
Describe exactly what the user sees.
Green stays ON for 5 seconds, turns OFF, then yellow turns ON for 2 seconds.
If MOSI means Master Out, Slave In, which device is the master and which is the slave in your RFID setup?
The Arduino is the master, and the RC522 is the slave.
If a = 5 and b = 2, what is the result of a * b + 4?
14 because 5 × 2 = 10, then 10 + 4 = 14.