#include <TimerOne.h>
unsigned long warten = 0;
static int ledou[] = {4, 5, 6};
static int ledlr[] = {8, 9, 10};
unsigned long previous = 0;
void setup() {
for (int i = 0; i < 3; i++) {
pinMode(ledou[i], OUTPUT);
pinMode(ledlr[i], OUTPUT);
}
Timer1.initialize(1000000);
Timer1.attachInterrupt(schaltungAn);
}
void loop() {
// schaltungAn();
}
void schaltungAn() {
unsigned long currentTime = millis();
if (currentTime - previous >= 1000) {
previous = currentTime;
for (int i = 0; i < 3; i++) {
digitalWrite(ledou[i], HIGH);
shortPause();
if (i == 0) {
digitalWrite(5, HIGH);
shortPause();
i++;
}
for (int j = 0; j < 3; j++) {
digitalWrite(ledou[j], LOW);
}
}
}
}
void schaltungAus() {
for (int i = 2; i >= 0; i--) {
digitalWrite(ledou[i], HIGH);
delay(1000);
digitalWrite(ledou[i], LOW);
}
}
void shortPause() {
unsigned long startMillis = millis();
while (millis() - startMillis < 1000) {
}
}
void longPause() {
unsigned long startMillis = millis();
while (millis() - startMillis < 5000) {
}
}