Rain Sensor, Infrared and in a LDR so Arduino code

Hello everyone, I have a project TCC and I wonder if I can use a rain sensor, an infrared and an LDR in a so Uno.Pos Arduino code to use when the three project does not work.

What Arduino? What code? What project? What is not working? What do you need?

I have a project of automated window, where use rain sensor, infrared sensor and LDR, all control a motor DC.Mais think the conflict in the code when you put everyone.

We can't see the code if you don't post it.

Use the # button to post it.

int input1 = 4; // IN1 Ponte H L298N
int enable1 = 2; // EN1 Ponte H L298N
int input2 = 5; // IN2 Ponte H L298N
int button1 = 6; // botao abrir
int button2 = 7; // botao fechar
int sensorChuva = 9; // sensor de chuva
int estadosensor = 0; // variavel memorizar estado sensor de chuva
int sensorparar = 10; // sensor infravermelho

void setup(){
pinMode(input1, OUTPUT);
pinMode(enable1, OUTPUT);
pinMode(input2, OUTPUT);
pinMode(button1, INPUT);
pinMode(button2, INPUT);
pinMode(sensorChuva, INPUT);
pinMode(sensorparar,INPUT);

}

void rotateLeft(){
digitalWrite(enable1, HIGH);
digitalWrite(input2, LOW);
digitalWrite(input1, HIGH);
}

void rotateRight(){
digitalWrite(enable1, HIGH);
digitalWrite(input1, LOW);
digitalWrite(input2, HIGH);
}

void parar(){
digitalWrite(enable1, LOW);
digitalWrite(input1, LOW);
digitalWrite(input2, LOW);
}

void loop(){

estadosensor = digitalRead(sensorChuva);

//----------------------------------------------------------------

while(digitalRead(button1) == HIGH) // codigo dos botoes abre/fechar
rotateLeft();

while(digitalRead(button2) == HIGH)
rotateRight();

//-------------------------------------------------------------------------
if(estadosensor == LOW) // codigo sensor de chuva
{
digitalWrite(input1,HIGH);
rotateLeft();
delay(1000);

}
if(estadosensor == HIGH)
{
digitalWrite(input2,HIGH);
rotateRight();
delay(1000);
}
else
{
digitalWrite(input1,LOW);
digitalWrite(input2,LOW);
digitalWrite(enable1,LOW);

}

}

If you want to use three sensors at the same time and each one of them can influence if your window will open or close. You need to rearrange the logic of your code. The while loops and the if statements are not linked with each other at this moment.
I also noticed that you have two push buttons, probably to override the sensors regardless of their input which will even make the logic more complex.

First step: use the functions you have created, don't duplicate them in your main loop. It's easier to maintain and makes the code more readable.
Second step: create a Karnaugh map with the states of each sensor and each possible outcome. It will give you an overview so you can better structure your logic.

A nice trick for the pushbuttons is to implement them with an interrupt handler. It will keep your main logic simple and allow you to break out of your main loop without having to add more if/else constructs

I also noticed you don't have an end switches to control the movement. How will you decide when to stop the movement?