Motor Rotation [Elevator]

Good morning people of the forum need to build an elevator controlling motor rotation, I want you found 6 knobs, 3 to rotate the motor clockwise and so gain ground, and other 3 counterclockwise to lower each buttons, bring to a particular floor, utilze infrared sensors for this part.
I intend to go to any floor from the current floor.

Here the code:

/*Control de relay*/
int relay = 10;
int relay2 = 11;
int BotonDer1 = 9;
int BotonDer2 = 8;
int BotonDer3 = 6;
int BotonIzq1 = 7;
int BotonIzq2 = 3;
int BotonIzq3 = 12;
int botonp1 =2;
int botonp2 =4;
int botonp3 =5;



void setup() {                

  pinMode(relay, OUTPUT);  
  pinMode(relay2, OUTPUT);  
  pinMode(BotonDer1,INPUT); 
  pinMode(BotonDer2,INPUT); 
  pinMode(BotonDer3,INPUT); 
  pinMode(BotonIzq1,INPUT); 
  pinMode(BotonIzq2,INPUT); 
  pinMode(BotonIzq3,INPUT); 
  
  pinMode(botonp1, INPUT);
  pinMode(botonp2, INPUT);
  pinMode(botonp3, INPUT);
}

void loop() {
  //PUSHBOTTON ARRANQUE DERECHO 1
  if (digitalRead (9) == HIGH){
    digitalWrite ( relay, HIGH);
    digitalWrite ( relay2, LOW);
  }
    else if (digitalRead (2) != HIGH){
      digitalWrite ( relay, LOW);
      digitalWrite ( relay, LOW);
  }
//PUSHBOTTON ARRANQUE DERECHO 2
 if (digitalRead (8) == HIGH){
    digitalWrite ( relay, HIGH);
    digitalWrite ( relay2, LOW);
  }
    else if (digitalRead (4) != HIGH){
      digitalWrite ( relay, LOW);
      digitalWrite ( relay, LOW);
  }

//PUSHBOTTON ARRANQUE DERECHO 3
 if (digitalRead (6) == HIGH){
    digitalWrite ( relay, HIGH);
    digitalWrite ( relay2, LOW);
  }
    else if (digitalRead (5) != HIGH){
      digitalWrite ( relay, LOW);
      digitalWrite ( relay, LOW);
  }
  
  //PUSHBOTTON ARRANQUE IZQUIERDO 1
   if (digitalRead (7) == HIGH){
    digitalWrite ( relay2, HIGH);
    digitalWrite ( relay, LOW);
   }
  else if (digitalRead (2) != HIGH){
      digitalWrite ( relay, LOW);
      digitalWrite ( relay2, LOW);
  }

    //PUSHBOTTON ARRANQUE IZQUIERDO 2
   if (digitalRead (3) == HIGH){
    digitalWrite ( relay2, HIGH);
    digitalWrite ( relay, LOW);
   }
  else if (digitalRead (13) != HIGH){
      digitalWrite ( relay, LOW);
      digitalWrite ( relay2, LOW);
  }

    //PUSHBOTTON ARRANQUE IZQUIERDO 3
   if (digitalRead (12) == HIGH){
    digitalWrite ( relay2, HIGH);
    digitalWrite ( relay, LOW);
   }
  else if (digitalRead (5) != HIGH){
      digitalWrite ( relay, LOW);
      digitalWrite ( relay2, LOW);
  }
    
  
}

Please modify your post and use the code button </> so your code looks like this and is easy to copy to a text editor. Then I will study it. See How to use the Forum Your code is too long to study quickly.

...R

omarigg:
Good morning people of the forum need to build an elevator controlling motor rotation, I want you found 6 knobs, 3 to rotate the motor clockwise and so gain ground, and other 3 counterclockwise to lower each buttons, bring to a particular floor, utilze infrared sensors for this part.
I intend to go to any floor from the current floor.

Here the code:

Was there a question in there?

Without comments within your code in English and a clearly-labelled diagram of your connections, there is nothing we can do.

BotonDer1 = 9;
int BotonDer2 = 8;
int BotonDer3 = 6;
int BotonIzq1 = 7;
int BotonIzq2 = 3;
int BotonIzq3 = 12;

This only tells us that they're buttons connected to pins, with no mention of their actual functions.
And you don't mention the exact function of each of the relays. "relay" and "relay2" tells us nothing.

Oh, and an actual question, as mentioned by Duane.

We aren't too good at mind-reading. :frowning:

This is a fairly complicated piece of code

 if (digitalRead (9) == HIGH){
    digitalWrite ( relay, HIGH);
    digitalWrite ( relay2, LOW);
  }
    else if (digitalRead (2) != HIGH){
      digitalWrite ( relay, LOW);
      digitalWrite ( relay, LOW);
  }

Can you explain in English (not code) what you want it to do.

Also it makes code much easier to understand if you give meaningful names to pin numbers.

And you need to tell us how your code actually behaves and how you want it to behave.

...R