What is the unit of delay in the code given below? [code] void setup() { Serial.begin(9600); } void loop() { digitalWrite(10,HIGH);

Lan Anh

New member
What is the unit of delay in the code given below?
Code:
void setup() {
    Serial.begin(9600);
}
void loop() {
    digitalWrite(10,HIGH);
    delay(1000);
    digitalWrite(10,LOW);
    delay(1000);
}
A. Milliseconds
B. Microseconds
C. Seconds
D. Minutes
 
Answer: A
Explanation: The delay() function is used to delay the execution of a command by a certain specified amount of time. This function takes only one argument and that is the time in milliseconds. In the code above we are giving a delay of 1000 ms or 1 s after each digitalWrite() command is executed.
 

Tìm kiếm

Back
Top