Please, help me green house

Well
I’m doing a final project , and nothing arduino , I want to know if I 'm good in a command to copy Internet

Someone could help me , I want you in a small greenhouse temperature, humidity and light is measured, as the case the plants are watered , a servo to cool lights , a fan is lit, warm and data matching an LCD screen. Please someone could correct me, I kick this video

#include <LiquidCrystal.h>
 LiquidCrystal lcd(12, 11, 0, 1, 10, 13);

#include "DHT.h"
#define DHTPIN 2
#define DHTTYPE DHT22
DHT dht(DHTPIN, DHTTYPE);
#include <Servo.h>
Servo byservo;

#define Bomba 6 //Seleccionar el pin en el que se conectara
#define Calentador 4
#define Ventilador 8
#define Foco 7


int HumSuelo;
int RefHumSuelo = 55;
int TolSuelo = 10;


float TemInterior;
int TolTemInterior = 3;
int RefTemInterior = 25; 


float HumAire;
int TolHumAire = 10 ;
int RefHumAire = 80;


float TemExterior;
int TolTemExterior =5;
int RefTemExterior = 20;

float Iluminacion;

int ldr=0;

int estado=0 ;
int menu = 0;

void setup (){
  lcd.begin(16, 2);
  pinMode(0, INPUT);//Pin que controlara el menu de la lcd
}

  Serial.begin(9600);//Se inicia la comunicacion serial
  dht.begin(); //Se inicia el sensor
  pinMode(Ventilador,OUTPUT); //Se declara el pin del rele que activa el ventilador
  pinMode(Bomba,OUTPUT);
  byservo.attach(5);
  pinMode(9, OUTPUT); //Sensor de lluvia
  pinMode(Calentador, OUTPUT); //Se empieza el pin del rele que activa el calentador
  
  digitalWrite(Ventilador,HIGH);//Se pone TODO a 0
  digitalWrite(Calentador,HIGH);
  digitalWrite(Bomba,HIGH);
  byservo.write(0)
)
void loop() {
  //Lecturas de sensores
  TemExterior = ((((analogRead(AQ)/1024.0)*5.0)-0.5)*100)
  HumAire = dht.readHumidity(); //Se lee la humedad
  TemInterior = dht.readTemperature(); //Se lee la temperatura
  HumSuelo = analogRead(2); //Lee la humedad del suelo
  HumSuelo= sap(HumSuelo,0, 1023,100,0); //convertir el valor de 01 a 100
  
  
  ldr = analogRead(Al);
  ldr = sap(1dr,0,1023,0,100);//convertir el valor analogico a un valor de 0 a 100, es decir, un porcentaje.
  
  
/*
  //Para monitorizarlo por el puerto serie
  Serial.printIn("Temperatura interior: ");
  Serial.printIn(TemInterior);
  Serial.printIn("Temperaturaexterior : ");
  Serial.printIn(TemExterior);
  Serial.printIn("Humedad: ");
  Serial.printIn(HumAire);
  Serial.print("Sensor de Humedad suelo");
  Serial.printIn(HumSuelo);
  Serial.print("Valor LDR; ");
  Serial.printIn(ldr);
  Serialprint("Estado: ");
  Serial.printIn(estado):
*/


 if(HumSuelo <= RefHumSuelo+TolSuelo && HumSuelo>= RefHumSuelo=TolSuelo)(
   digitalWrite(Bomba,HIGH);
 }else(digitalWrite(Bomba,LOW);}
 
 
 if(TemInterior <= RefTemInterior=TolTemInterior)(
    estado=1;
 }
 if(TemInterior >= RefTemInterior+TolTemInterior)(
 
    estado=2;
 }
 if(HumAire <= RefHumAire=TolHumAire)(
 
    estado=3;
 }
 if(HumAire >= RefHumAire+TolHumAire)(
    estado=4;
    
 }
 
 if(TemInterior <= RefTemInterior-TolTemInterior && HumAire <= RefHumAire-TolHumAire)(
    estado=5;
 
 )
 
 if(TemInterior <= RefTemInterior-TolTemInterior && HumAire >= RefHumAire+TolHumAire)(
    estado=6;
    
 )
 if(TemInterior <= RefTemInterior+TolTemInterior && HumAire <= RefHumAire-TolHumAire)(
    estado=7;
 
 )
 
 if(TemInterior <= RefTemInterior+TolTemInterior && HumAire >= RefHumAire+TolHumAire)(
    estado=8;
    
 )
  
 if( TemInterior >= RefTemInterior-TolTemInterior && TemInterior <= RefTemInterior+TolTemInterior && HumAire >= RefHumAire-TolHumAire && HumAire <= RefHumAire+TolHumAire)
    (estado=9;) 



switch(estado)(
   case 0:
   
   break,
   
   case 1:
   digitalWrite(Calentador,LOW); //Encender calentador
   digitalWrite(Ventilador,HIGH);
   
   
   break;
   
   case 2:
   
   digitalWrite(Calentador,HIGH);
   if(TemExterior<=TemInterior+TolTemExterior && digitalRead(9)== 1)(
     byservo.write(100);
   )
   if(TemExterior<=TemInterior+TolTemExterior && digitalRead(9)== 0)(
   digitalWrite(Ventilador,LOW);
   )
   if(TemExterior>=TemInterior)(
   digitalWrite(Ventilador,LOW);
   )
   
   break;
   
   case 3;
   
   digitalWrite(Ventilador,HIGH);
   digitalWrite(Calentador,HIGH);
   byservo.write(0);
   
   digitalWrite(Humificador,LOW);
   
   break;
   
   case 4;
   
   digitalWrite(Calentador,HIGH);
   byservo.write(0);
   
   break;
   
   case 5;
   
   digitalWrite(Ventilador,HIGH);
   byservo.write(0)
   
   
  //Pin del calentador
  digitalWrite(Calentador,LOW);
  
  break;
  
  case 6;
  
  byservo.write(0);
  
  digitalWrite(Calentador,LOW);
  digitalWrite(Ventilador,LOW);
  
  break;
  
  case 7;
  
  digitalWrite(Calentador,HIGH);
  
  if(TemExterior<=TemInterior+TolExterior && digitalRead(9)== 1)(
    byservo.write(100);
    digitalWrite(Ventilador,HIGH);
  )
  if(TemExterior<=TemInterior+TolTemExterior && digitalRead(9)== 0)(
  digitalWrite(Ventilador,LOW);
  byservo.write(0);
  )
  
  breack;
  
  case 8;
  digitalWrite(Calentador,HIGH);
  
  if(TemExterior<=TemInterior+TolTemExterior && digitalRead(9)== 1)(
     byservo.write(100);
     digitalWrite(Ventilador,LOW)
  )
  if(TemExterior<=TemInterior+TolTemExterior && digitalRead(9)==0)(
  digitalWrite(Ventilador,LOW);
  byservo.write(0);
  )
  if(TemExterior>=TemInetior)(
  digitalWrite(Ventilador,LOW);
  byservo.write(0);
  )
  
  break;
  
  case 9;
  
  digitalWrite(Ventilador,HIGH);
  digitalWrite(Calentador,HIGH);
  byservo.write(0);
  break;

)


//Datos puerto serie labview
 Serial.println(TemInterior);
  Serial.println(HumAire);
  Serial.println(HumSuelo);
  Serial.println(ldr);
  Serial.println(estado);
  Serial.println(digitalRead(Ventilador));
  Serial.println(digitalRead(Calentador));
  Serial.println(digitalRead(Bomba));
 RefTemInterior= Serial.read();
 RefHumSuelo= Serial.read();
 
 //Control de la pantalla lcd
 if (digitalRead(3) == 1) (
 
     menu-+;)
    if (menu > 2) (
      menu = 0;
    )
    
 
 
switch (menu)  (
 case 0:
  lcd.setCursor(0, 0);
  lcd.print("Equipo Arduino");
  lcd.setCursor(0, 1);
  lcd.print("GreenProyect");
  break;
 case 1;
  ldr = analogRead(Al);//Leer el valor de la ldr
  ldr= map(ldr,0,1020,0,100);//convertir el valor de la ldr
  lcd.clear();
  lcd.setCursor(0,0);
  lcd.print("Luminosidad");
  lcd.setCursor(0, 1);
  lcd.print(ldr);
  lcd.print(" %");
  
  
  break;
 case 2;
  TemInterior = dht.readTemperature(); //Se lee la temperatura interior
   lcd.clear();
   lcd.setCursor(0, 0);
   lcd.print("Temperatura");
   lcd.setCursor(0, 1);
   lcd.print(TemInterior);
   lcd.print(" *C")
   
   break;
 case 3;
   HumAire = dht.readHumidity(); //Se lee la humedad
   lcd.clear();
   lcd.setCursor(0, 0);
   lcd.print("Humedad Relativa");
   lcd.setCursor(0, 1);
   lcd.print(HumAire);
   lcd.print(" %");
   
   break:
 )
)

Codigo_Invernadero.ino (6.25 KB)

Please explain your question in more detail. I have no idea what you want.

Also put your code in code tags (</> icon) so everyone can read it without having to open the IDE.

Weedpharma

Attach your code using the </> icon on the left side of the posting menu.
Put your sketch between the code tags [code][/code]

Although this is legitimate C code

 if(HumSuelo <= RefHumSuelo+TolSuelo && HumSuelo>= RefHumSuelo=TolSuelo)

it is probably NOT what was intended, especially with the trailing ‘(’ (not shown).

It appears that ‘;’, ‘:’, ‘{’, and ‘(’ are thrown around with abandon and without an understanding of their purpose.

Also, digitalRead(…) is documented to return LOW or HIGH. I suppose that it could return 1 but that is not the way that the documentation is written.

To post:

  1. Use CTRL-T in the Arduino IDE to autoformat your code.
  2. Paste the autoformatted code between code tags (the </> button)
    so that we can easily see and deal with your code.

I'm
stressed, help :frowning: :confused:

What is your question? I have a thread currently using temp and humidity to control heaters/AC and humidifier/dehumidifier so all you would need is code to control your servo to control the cooling fan. Seems similar

You could give it to me?

Maya13:
You could give it to me?

If you click on paintballer's name, you can see a link called "posts" in his/her profile. If you click on that, you can find the thread that is mentioned.

Also, in this thread I see several questions and requests for clarification. You never responded to them. It is hard to help you if you don't respond to such things.

Your other thread deleted. Don't cross-post.

Maya13:
You could give it to me?

Where is the learning experience in that?

Weedpharma

weedpharma:
Where is the learning experience in that?

One will learn how plagiarism in final projects is handled by the examination board?

I'm doing a final project , and nothing arduino , I want to know if I 'm good in a command to copy Internet

Nothing Arduino, eh? Why post here?

Maya13:
You could give it to me?

Asking to have your final projects solved by other people is assuming that your teachers/examiners haven't heard of the Internet. They will be monitoring these forums, and if the code you submit happens to be identical to what someone else gave you, you will fail.

My father was a professor. A student made the mistake of submitting an essay that, unknown to himself, was originally written by my father. :slight_smile: True story. I would have liked to have seen the look on his face when it was explained to him.

Thank you for your comments , but mark me here apartir many mistakes

  TemExterior = (analogRead(AQ)/1024.0)*5.0)-0.5)*100)
  HumAire = dht.readHumidity(); //Se lee la humedad
  TemInterior = dht.readTemperature(); //Se lee la temperatura
  HumSuelo = analogRead(2); //Lee la humedad del suelo
  HumSuelo= sap(HumSuelo,0, 1023,100,0); //convertir el valor de 01 a 100
  
  
  ldr = analogRead(Al);
  ldr = sap(1dr,0,1023,0,100);//convertir el valor analogico a un valor de 0 a 100, es decir, un porcentaje.
  
  

  Serial.printIn("Temperatura interior: ");
  Serial.printIn(TemInterior);
  Serial.printIn("Temperaturaexterior : ");
  Serial.printIn(TemExterior);
  Serial.printIn("Humedad: ");
  Serial.printIn(HumAire);
  Serial.print("Sensor de Humedad suelo");
  Serial.printIn(HumSuelo);
  Serial.print("Valor LDR; ");
  Serial.printIn(ldr);
  Serialprint("Estado: ");
  Serial.printIn(estado):
*/


 if(HumSuelo <= RefHumSuelo+TolSuelo && HumSuelo>= RefHumSuelo=TolSuelo)(
   digitalWrite(Bomba,HIGH);
 }else(digitalWrite(Bomba,LOW);}
 
 
 if(TemInterior <= RefTemInterior=TolTemInterior)(
    estado=1;
 }
 if(TemInterior >= RefTemInterior+TolTemInterior)(
 
    estado=2;
 }
 if(HumAire <= RefHumAire=TolHumAire)(
 
    estado=3;
 }
 if(HumAire >= RefHumAire+TolHumAire)(
    estado=4;
    
 }
 
 if(TemInterior <= RefTemInterior-TolTemInterior && HumAire <= RefHumAire-TolHumAire)(
    estado=5;
 
 )
 
 if(TemInterior <= RefTemInterior-TolTemInterior && HumAire >= RefHumAire+TolHumAire)(
    estado=6;
    
 )
 if(TemInterior <= RefTemInterior+TolTemInterior && HumAire <= RefHumAire-TolHumAire)(
    estado=7;
 
 )
 
 if(TemInterior <= RefTemInterior+TolTemInterior && HumAire >= RefHumAire+TolHumAire)(
    estado=8;
    
 )
  
 if( TemInterior >= RefTemInterior-TolTemInterior && TemInterior <= RefTemInterior+TolTemInterior && HumAire >= RefHumAire-TolHumAire && HumAire <= RefHumAire+TolHumAire)
    (estado=9;) 



switch(estado)(
   case 0:
   
   break,
   
   case 1:
   digitalWrite(Calentador,LOW); //Encender calentador
   digitalWrite(Ventilador,HIGH);
   
   
   break;
   
   case 2:
   
   digitalWrite(Calentador,HIGH);
   if(TemExterior<=TemInterior+TolTemExterior && digitalRead(9)== 1)(
     byservo.write(100);
   )
   if(TemExterior<=TemInterior+TolTemExterior && digitalRead(9)== 0)(
   digitalWrite(Ventilador,LOW);
   )
   if(TemExterior>=TemInterior)(
   digitalWrite(Ventilador,LOW);
   )
   
   break;
   
   case 3;
   
   digitalWrite(Ventilador,HIGH);
   digitalWrite(Calentador,HIGH);
   byservo.write(0);
   
   digitalWrite(Humificador,LOW);
   
   break;
   
   case 4;
   
   digitalWrite(Calentador,HIGH);
   byservo.write(0);
   
   break;
   
   case 5;
   
   digitalWrite(Ventilador,HIGH);
   byservo.write(0)
   
   
  //Pin del calentador
  digitalWrite(Calentador,LOW);
  
  break;
  
  case 6;
  
  byservo.write(0);
  
  digitalWrite(Calentador,LOW);
  digitalWrite(Ventilador,LOW);
  
  break;
  
  case 7;
  
  digitalWrite(Calentador,HIGH);
  
  if(TemExterior<=TemInterior+TolExterior && digitalRead(9)== 1)(
    byservo.write(100);
    digitalWrite(Ventilador,HIGH);
  )
  if(TemExterior<=TemInterior+TolTemExterior && digitalRead(9)== 0)(
  digitalWrite(Ventilador,LOW);
  byservo.write(0);
  )
  
  breack;
  
  case 8;
  digitalWrite(Calentador,HIGH);
  
  if(TemExterior<=TemInterior+TolTemExterior && digitalRead(9)== 1)(
     byservo.write(100);
     digitalWrite(Ventilador,LOW)
  )
  if(TemExterior<=TemInterior+TolTemExterior && digitalRead(9)==0)(
  digitalWrite(Ventilador,LOW);
  byservo.write(0);
  )
  if(TemExterior>=TemInetior)(
  digitalWrite(Ventilador,LOW);
  byservo.write(0);
  )
  
  break;
  
  case 9;
  
  digitalWrite(Ventilador,HIGH);
  digitalWrite(Calentador,HIGH);
  byservo.write(0);
  break;

)


//Datos puerto serie labview
 Serial.println(TemInterior);
  Serial.println(HumAire);
  Serial.println(HumSuelo);
  Serial.println(ldr);
  Serial.println(estado);
  Serial.println(digitalRead(Ventilador));
  Serial.println(digitalRead(Calentador));
  Serial.println(digitalRead(Bomba));
 RefTemInterior= Serial.read();
 RefHumSuelo= Serial.read();
 
 //Control de la pantalla lcd
 if (digitalRead(3) == 1) (
 
     menu-+;)
    if (menu > 2) (
      menu = 0;
    )
    
 
 
switch (menu)  (
 case 0:
  lcd.setCursor(0, 0);
  lcd.print("Equipo Arduino");
  lcd.setCursor(0, 1);
  lcd.print("GreenProyect");
  break;
 case 1;
  ldr = analogRead(Al);//Leer el valor de la ldr
  ldr= map(ldr,0,1020,0,100);//convertir el valor de la ldr
  lcd.clear();
  lcd.setCursor(0,0);
  lcd.print("Luminosidad");
  lcd.setCursor(0, 1);
  lcd.print(ldr);
  lcd.print(" %");
  
  
  break;
 case 2;
  TemInterior = dht.readTemperature(); //Se lee la temperatura interior
   lcd.clear();
   lcd.setCursor(0, 0);
   lcd.print("Temperatura");
   lcd.setCursor(0, 1);
   lcd.print(TemInterior);
   lcd.print(" *C")
   
   break;
 case 3;
   HumAire = dht.readHumidity(); //Se lee la humedad
   lcd.clear();
   lcd.setCursor(0, 0);
   lcd.print("Humedad Relativa");
   lcd.setCursor(0, 1);
   lcd.print(HumAire);
   lcd.print(" %");
   
   break:
 )
)

Look at the very first line. Count the number of ")". Now count the number of "(". Do you know what these symbols do?

AQ ?

aarg:
My father was a professor. A student made the mistake of submitting an essay that, unknown to himself, was originally written by my father. :slight_smile: True story. I would have liked to have seen the look on his face when it was explained to him.

Yes, you can imagine:

"This essay is very good. Exactly the sort of thing I wanted. I might have written it myself. ... Wait, I did write it myself!"