int green=5;
int red=6;              //Pin der LED
int t=800;              //Leuchtzeit
int buttonPin=8;        //Pin zum auslesen
int Farbe=green;
int z=0;
void setup() {
  pinMode(5, OUTPUT);
  pinMode(6, OUTPUT);
  pinMode(buttonPin, INPUT);
}
void blinken(int k, int color) {
  for (int i=0; i<1; i++){
   digitalWrite(color, HIGH);
   delay(k);
   digitalWrite(color, LOW);
   delay(k/2);
  }
}

void lichtan(int color) {
  if (color!=z) {
    digitalWrite(z, LOW);
    digitalWrite(color, HIGH);
  }
  z = color;
}

/*
void loop() {
  blinken(t, Farbe);
  if (digitalRead(buttonPin)==HIGH) {
    if (Farbe==green) {
      Farbe=red;
    }
    else {
      Farbe=green;
    }
  }
}
*/

void loop() {
  lichtan(Farbe);
  if (digitalRead(buttonPin)==HIGH) {
    if (Farbe==green) {
      Farbe=red;
    }
    else {
      Farbe=green;
    }
    while (digitalRead(buttonPin)==HIGH) {
      delay(100);
    }
  } 
}
$abcdeabcde151015202530354045505560fghijfghij