Programming Arduino (1) Pages 64
Programming Arduino (1) Pages 64
digitalWrite(ledPin, LOW);
delay(delayPeriod);
count ++;
if (count == 20)
count = 0;
delay(3000);
So now each time that loop is run, it will take just a bit more than 200
milliseconds, unless it’s the 20th time round the loop, in which case it will take
the same plus the three seconds delay between each batch of 20 flashes. In fact,
for some applications, even this is too slow, and purists would say that you
should not use delay at all. The best solution depends on the application.
while