 // Boolean Felder Raten.
 boolean floor_og=false;
 boolean floor_eg=false;
-
-char mode[4]; // ein Reservierter Speicher fuer Modus ON / OFF
+boolean chkfix=true;
+
 unsigned long relaistime = 60000L; // Schalte die Relais Versorgungsspannung nach 1min. ab.
 // Wie lange das Relais den Status ON hat bis es wieder abgeschalten wird. Somit kann es
 // einen bestimmten Weg zuruecklegen.

    digitalWrite(RO, HIGH);
    ROState=false;
  }
  //Serial.println(ROState);
}

void SecRelais1(char mode){
  /*
   * Relais 1 with state check (DOWN)
   */
  if (mode == "ON") {
    if (S1State == false && S2State == false) {
      S1State=true;
      //liftdown=true;
      //liftup=false;
      digitalWrite(S1, LOW);
    } else if (S1State == false && S2State == true) {
      digitalWrite(S2, HIGH);
      S2State=false;
      //liftup=false;
      delay(80);
      S1State=true;
      //liftdown=true;
      digitalWrite(S1, LOW);
    } else if (S1State == true && S2State == false) {
      // do nothing
    }
  } else {
    digitalWrite(S1, HIGH);
    S1State=false;
  }
  //Serial.println(S1State);
}

void SecRelais2(char mode){
  /*
   * Relais 2 with state check (UP)
   */
  if (mode == "ON") {
    if (S2State == false && S1State == false) {
      S2State=true;
      digitalWrite(S2, LOW);
    } else if (S2State == false && S1State == true) {
      digitalWrite(S1, HIGH);
      S1State=false;
      delay(80);

    digitalWrite(S2, HIGH);
    S2State=false;
  }
}


//Callback function is called only when a valid code is received.
char checkCode(unsigned long receivedCode, unsigned int period){
  //Note: interrupts are disabled. You can re-enable them if needed.

  //print received code
  /*
  Serial.print("Code = ");
  Serial.println(receivedCode);
  getboolstates();
  */
  
  if (receivedCode == 531272) {
    task2 = millis();
    //Serial.println("Switch Relais 1 ON");
    SWRelais("ON");
    SecRelais1("ON");
  
  } else if (receivedCode == 531380) {
    //Serial.println("Switch Relais 2 ON");
