निम्नलिखित Arduino कोड में while लूप क्या करता है?
What does the while loop in the following Arduino code do?
while(analogRead(sensorPin) > 100)
{
flashLED(); // call a function to turn an LED on and off
}
A
Calls flashLED() if reading < 100
B
Calls flashLED() once if reading > 100
C
Repeats flashLED() while reading > 100
D
Stops flashLED() if reading > 100.
Explanation
In this Arduino code, the while loop continuously calls the flashLED() function as long as the analog reading from the sensor (obtained using analogRead(sensorPin)) is greater than 100. Once the sensor reading drops to 100 or below, the loop stops executing.
So, the loop repeats the flashLED() function as long as the sensor value is above 100.
Correct Answer:
(C) Repeats flashLED() while reading > 100.
Correct Answer: C) Repeats flashLED() while reading > 100