/*
das soll mal ein LaufLicht werden
hin und her (falls ich das schaffe)
*/
byte LEDS[] = {PB0, PB1, PB2, PB3, PB4, PB5};
byte anzahl = sizeof(LEDS);
bool hin_und_her = true;
void setup() {
// put your setup code here, to run once:
for (int i = 0; i < anzahl; i++) {
pinMode(LEDS[i], OUTPUT);
}
}
// schaltet alle LEDs aus
void alles_aus() {
for (int i = 0; i < anzahl; i++) {
digitalWrite(LEDS[i], LOW);
}
}
// schaltet genau eine an
void eine_an(int i) {
alles_aus();
digitalWrite(LEDS[i], HIGH);
}
void loop() {
// put your main code here, to run repeatedly:
// vorwärts
for (int i = 0; i < anzahl; i++) {
eine_an(i);
delay(500);
}
if (hin_und_her) {
// rückwärts
for (int i = anzahl - 2; i > 0; i--) {
eine_an(i);
delay(500);
}
}
}