🚀 Hurry! Offer Ends In
00 Days
00 Hours
00 Mins
00 Secs
Enroll Now
X

यदि वस्तु सेंसर की ओर बढ़ रही है निम्नलिखित कोड के आउटपुट की भविष्यवाणी करें।

Predict the output of the following code if the object is moving towards the sensor.

int op = 6;
int isBarrier = HIGH;
void setup() {
pinMode(op, INPUT);
Serial.begin(9600);
}
void loop() {
isBarrier = digitalRead(op);
if (isBarrier == LOW) {
Serial.println("1+");
}
else {
Serial.print("clear+");
}
delay(100);
}

A)
B)
C)
D)

Explanation:

As the object moves towards the sensor, it will block it, causing the sensor to read LOW, which prints 1+. If the object moves away, it will read HIGH, printing clear+.

Output: (A) clear+clear+1+1.

Latest Updates