//
// https://forum.arduino.cc/t/blink-without-delay-leuchtturm-roter-sand/1328810/16?u=kai-r
// 

#include "TaskMacro.h"

constexpr unsigned long kurz {1250};
constexpr unsigned long lang {4000};

Task dauerBlink()
{
  constexpr byte pinDauerBlink {2};
  taskBegin();
  pinMode(pinDauerBlink, OUTPUT);
  while(1)
  {
    digitalWrite(pinDauerBlink,1);
    taskPause(kurz);
    digitalWrite(pinDauerBlink,0);
    taskPause(kurz);
  }
  taskEnd();
}

Task codeBlink()
{
  constexpr byte pinCodeBlink {1};
  taskBegin();
  pinMode(pinCodeBlink, OUTPUT);
  while(1)
  {
    digitalWrite(pinCodeBlink,1);
    taskPause(kurz);
    digitalWrite(pinCodeBlink,0);
    taskPause(kurz);
    digitalWrite(pinCodeBlink,1);
    taskPause(kurz);
    digitalWrite(pinCodeBlink,0);
    taskPause(lang);
  }
  taskEnd();
}

void setup() 
{
}

void loop() 
{
  dauerBlink();
  codeBlink();
}
ATTINY8520PU