Microcontroller › Arduino › arduino LED blink without delay › arduino LED blink without delay
September 14, 2015 at 5:13 am
#13286
Participant
Hi, You can use this code,
int led=13,ledstate;
int previous=0;
int interval=2000;
boolean toggle = false;
void setup()
{
pinMode(led,OUTPUT);
}
void loop ()
{
int current=millis();
if(current – previous>=interval)
{
previous=current;
toggle = !toggle;
digitalWrite(13,toggle);
}
}