In Arduino programming, to use time delay at post before, we use sintax as follows:
delay(1000);
for time delay for 1000 milisecond.
One of using of time delay is to make blinking Arduino program, example:
int ledpin = 13;
voip setup(){
pinMode(ledpin, OUTPUT);
}
voip loop(){
digitalWrite(ledpin, HIGH);
delay(1000);
digitalWrite(ledpin, LOW);
delay(1000);
}
We can also write program above with diffrent sintax for time delay, so that our porgram code be like this:
int ledpin = 13;
int waktu = 1000;
voip setup(){
pinMode(ledpin, OUTPUT);
}
voip loop(){
digitalWrite(ledpin, HIGH);
delay(waktu);
digitalWrite(ledpin, LOW);
delay(waktu);
}
So, we can make time delay sintax with 2 version, that's all, very simple, hope add Arduino programming concept, thank you...
delay(1000);
for time delay for 1000 milisecond.
One of using of time delay is to make blinking Arduino program, example:
int ledpin = 13;
voip setup(){
pinMode(ledpin, OUTPUT);
}
voip loop(){
digitalWrite(ledpin, HIGH);
delay(1000);
digitalWrite(ledpin, LOW);
delay(1000);
}
We can also write program above with diffrent sintax for time delay, so that our porgram code be like this:
int ledpin = 13;
int waktu = 1000;
voip setup(){
pinMode(ledpin, OUTPUT);
}
voip loop(){
digitalWrite(ledpin, HIGH);
delay(waktu);
digitalWrite(ledpin, LOW);
delay(waktu);
}
So, we can make time delay sintax with 2 version, that's all, very simple, hope add Arduino programming concept, thank you...
0 komentar:
Posting Komentar