Blink LED Async

void blink() {
  static boolean blinkLed;
  static unsigned long Blinktime;
  const int ledPin = 13;
  const int delayMsec = 1000;
  pinMode(ledPin, OUTPUT);
  if ( millis() > Blinktime ) {
    if (blinkLed) { digitalWrite(ledPin, HIGH); }
    else { digitalWrite(ledPin, LOW); }
    blinkLed = !blinkLed;
    Blinktime = millis() + delayMsec;
    Serial.println();
    Serial.print("Blink.");Serial.print(blinkLed);
    Serial.println();
  }; 
}

...


CategoryElectronics

Arduino/ScetchAsyncBlinkPin13Led (last edited 2014-02-23 20:11:05 by PieterSmit)