PASAR 1
PASAR 2
PASAR 3
PASAR 4
PASAR 5
500

pinMode(button, INPUT_PULLUP);


if (digitalRead(button) == LOW) {

    digitalWrite(red, HIGH);

}

Why does the program execute the if statement when the button reads LOW, instead of HIGH?

Because the button is configured using INPUT_PULLUP. With this setup, pressing the button makes the pin read LOW. In your actual traffic-light program, a LOW reading is therefore treated as a button press.

500

Suppose the registered UID is:

const String registeredUID = "6457E12B";

The scanned card has: 6457E12B 

If the program compares the two UIDs, should the card be accepted or rejected?

Accepted, because the scanned UID matches the registered UID.

500

int age = 20;

bool registered = false;


if (age >= 18 && registered) {

    Serial.println("You may vote.");

} else {

    Serial.println("Not eligible.");

}

The person is already 20 years old. Why does the program still print “Not eligible”?

Because && means AND, so both conditions must be true. age >= 18 is true, but registered is false.

500

lcd.setCursor(0, 0);

lcd.print("Distance:");

lcd.setCursor(0, 1);

lcd.print(distance);

What information appears on each row of a 16×2 LCD?

“Distance:” appears on the first row, and the distance value appears on the second row.

500

for (int i = 0; i < 3; i++) {

    digitalWrite(LED, HIGH);

    delay(500);

    digitalWrite(LED, LOW);

    delay(500);

}

How many complete blinks occur?

3 complete blinks

500

digitalWrite(yellow, HIGH); delay(10000); digitalWrite(yellow, LOW); digitalWrite(red, HIGH);

Describe exactly what happens before the red LED turns ON.  

The yellow LED turns ON and remains ON for 10 seconds. After 10 seconds, yellow turns OFF and red turns ON.

500

What symbols are used to create a multi-line comment in C/C++?

/* to begin and */ to end

500

distance = duration * 0.0343 / 2;

Why do we divide by 2?

Because duration includes the sound traveling to the object and back. We only need the one-way distance.

500

A student connects the ultrasonic sensor's Trig and Echo pins correctly but forgets to connect VCC. What problem would you expect?

The sensor will not receive power, so it cannot operate properly. VCC supplies power and is connected to the Arduino's 5V pin in the lesson.

500

Your sensor works in the Serial Monitor, but nothing appears on the LCD. Does this automatically mean the sensor is broken? Explain.

No. Since the Serial Monitor receives the sensor value, the sensor is likely working. The problem may be with the LCD wiring, initialization, address, cursor, or display code.

500

if (uidString == registeredUID) {

  digitalWrite(greenLED, HIGH);

} else {

  digitalWrite(redLED, HIGH);

}

A card is successfully scanned, but its UID is different from registeredUID. What will happen, and why?

The red LED turns ON because the UID comparison is false, so the else block executes.

500

if (buttonState == HIGH) {

  digitalWrite(led, HIGH);

  tone(buzzer, 1000);

}

What problem might occur after the button is released?

There is no code telling the LED and buzzer to turn OFF. An else should be added with digitalWrite(led, LOW) and noTone(buzzer).

500

if (uidString == registeredUID) {

    digitalWrite(greenLED, HIGH);

} else {

    digitalWrite(redLED, HIGH);

}

What determines whether the green or red LED turns ON?

 

The result of the UID comparison. If uidString matches registeredUID, the green LED turns ON. Otherwise, the else executes and the red LED turns ON.

500

lightValue = analogRead(A0); 

if (lightValue < 300) { 

 digitalWrite(led, HIGH); 

}

Assuming lower readings represent darkness, when does the LED turn ON?  

When the reading falls below 300, meaning it is relatively dark.

500

System.out.print("Name: ");

System.out.println("John");

System.out.print("Age: 18");

What will the output look like?

Name: John 

Age: 18

500

#include <Servo.h>

Servo gate;

void setup() {

    gate.attach(7);

}

What is the purpose of gate.attach(7);?

It tells Arduino that the signal wire of the servo represented by gate is connected to digital pin 7.

500

LiquidCrystal_I2C lcd(0x27, 16, 2);

What do 0x27, 16, and 2 tell Arduino?

0x27 is the I2C address, 16 is the number of columns, and 2 is the number of rows of the LCD.

500
int lightValue = analogRead(A0); 
if (lightValue > 500) {  
digitalWrite(led, HIGH); } 
else {  
digitalWrite(led, LOW); }

What happens when lightValue is exactly 500?

The LED turns OFF because 500 > 500 is false.  

500

Why is analogRead() more appropriate than digitalRead() when you want to know how bright the environment is?

analogRead() gives a range of values representing different light levels, while digitalRead() mainly gives HIGH or LOW.

500

Two RFID cards look exactly the same. Can Arduino still distinguish between them? Why?

Yes. Each card can have a different UID (Unique Identifier), allowing Arduino to distinguish one tag from another.

500

int number = 25;

lcd.print("Value: ");

lcd.print(number);

What will be displayed?


Value: 25

500

for (int i = 0; i < 4; i++) {

    Serial.println("Robot");

}

Predict the output:

Robot

Robot

Robot

Robot

500

int i = 0;

while (i < 3) {

    Serial.println(i);

    i++;

}

What happens if i++; is removed?

i remains 0, so i < 3 continues to be true. The loop can continue indefinitely because nothing changes i to eventually make the condition false.

500

for (int i = 0; i < 5; i++) {

    lcd.setCursor(i, 0);

    lcd.print("*");

}

Predict what happens:

 

Predict what happens:

500

gate.write(0);

delay(1000);

gate.write(180);

Describe what the servo does.

The servo moves to 0°, waits for 1 second, and then moves to 180°.

M
e
n
u