Blink Without Delay – Arduino

Code

int ledpin=13;
int value=LOW;
long previousmillis=0;
long interval = 100;
void setup() {
  // put your setup code here, to run once:
pinMode(ledpin,OUTPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
  long currentMillis=millis();
if(currentMillis-previousmillis>interval){
  previousmillis=millis();
  if(value==LOW){
  value=HIGH;
}else{
  value=LOW;
}
digitalWrite(ledpin,value);
}
}

 

It would be a great help, if you support by sharing :)
Author: zakilive

Leave a Reply

Your email address will not be published. Required fields are marked *