LED delay off with milli()
the led blinky quite easy how can done switch off after on second.
here i've created function , called within loop. way call several times like
would above approach best
code: [select]
void led(int val) {
unsigned long currentmillis = millis();
if (currentmillis - previousmillis >= val)
{
digitalwrite(led, high);
previousmillis = currentmillis;
}
}
void loop()
{
led(600);
}
here i've created function , called within loop. way call several times like
code: [select]
void loop();
{
led (100)
led(1000);
led(600);
would above approach best
digitalwrite(led, high);
change to
digitalwrite(led, !(digitalread(led)); // toggles led
change to
digitalwrite(led, !(digitalread(led)); // toggles led
Arduino Forum > Using Arduino > Project Guidance > LED delay off with milli()
arduino
Comments
Post a Comment