   }
 }
 
+static const unsigned long maxBlinkLoops = 3; /* parallel blinks */
+static unsigned long blinkSpec[maxBlinkLoops][3]; /* 
+lednr -> blink-count, active-mili, inactive-mili */
+unsigned long blinks[maxBlinkLoops]; /*
+    lednr -> remaining periods */
+long ledState [maxBlinkLoops]; /*
+	lednr -> signed for inactive-mili started, unsigned for active-mili started */
+static long led[maxBlinkLoops] = {
+    LED_GREEN,
+    LED_YELLOW,
+    LED_RED
+};
+
+void debugLeds() {
+    Serial.print("Blinks: ");
+    for (int i=0;i<maxBlinkLoops;i++) {
+        Serial.print(blinks[i]);
+        Serial.print(' ');
+    }
+    Serial.println(' ');
+    Serial.print("States: ");
+    for (int i=0;i<maxBlinkLoops;i++) {
+        Serial.print(ledState[i]);
+        Serial.print(' ');
+    }
+    Serial.println(' ');
+}
+
+void blinkPrime(int i, long count, long high, long low) {
+    blinkSpec[i][0] = count;
+    blinkSpec[i][1] = high;
+    blinkSpec[i][2] = low;
+    blinks[i] = blinkSpec[i][0]-1;
+    ledState[i] = millis()+blinkSpec[i][1];
+    if (ledState[i] > 0) {
+        digitalWrite(led[i], HIGH);
+    }
+}
+void execLeds() {
+    for (int i=0;i<maxBlinkLoops;i++) {
+        if (ledState[i] > 0) {
+            if (ledState[i] <= millis()) {
+                /* end of active periodhalf, set for inactive half */
+                ledState[i] = 0-(millis()+blinkSpec[i][2]);
+                digitalWrite(led[i], LOW);
+            }
+        } else if (ledState[i] < 0) {
+            if (0-ledState[i] <= millis()) {
+                /* end of inactive periodhalf, set for next blink or end */
+                if (blinks[i]) {
+                    blinks[i]--;
+                    ledState[i] = millis()+blinkSpec[i][1];
+                    digitalWrite(led[i], HIGH);
+                } else {
+                    ledState[i] = 0;
+                }
+            }
+        }
+    }
+}
 static void printMillis() {
-	blink(LED_YELLOW, 1, 6, 40);
 
 	static unsigned long lasttime = 0;  // static vars remembers values over function calls without being global
 
 	if (millis() - lasttime <= REPORT_DELAY) return;  // instead of delay(2) just ignore if called too fast 
+
 	lasttime = millis();
+    blinkPrime( 0, 3, 30, 40);
 
 	Serial.println();
 	Serial.print(count);	

	return millis() / 1000;
}

void blink(int led, int count, int length, int length_off=0) {
  for (int i=0;i<count;i++) {
    digitalWrite (led, HIGH);

#define LED_GREEN     7

#define REPORT_DELAY 1000
#define RED_DELAY    6000


static unsigned long count;
