0% found this document useful (0 votes)
32 views5 pages

Include

This JSON defines variables and objects for reading temperature and humidity sensors and controlling servo motors to manage humidity levels based on sensor readings and user-defined setpoints.

Uploaded by

Alexander Aliaga
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views5 pages

Include

This JSON defines variables and objects for reading temperature and humidity sensors and controlling servo motors to manage humidity levels based on sensor readings and user-defined setpoints.

Uploaded by

Alexander Aliaga
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

#include <LiquidCrystal.

h>

#include <DHT.h>

#include <Servo.h>

LiquidCrystal lcd (1,312,11,10,9,8);

int OUTPUT1 = 7;

int OUTPUT2 = 6;

int OUTPUT3 = 4;

int temp1, humed1, temp2, humed2, temp3, humed3, tempp;

int sp1, sp2, sp3, m1, m2, m3;

int sensor1=A2;

int sensor2=A1;

int sensor3=A0;

int pulsadormas=1;

int pulsadormenos=1;

DHT dht1 (sensor1, DHT11);

DHT dht2 (sensor2, DHT11);

DHT dht3 (sensor3, DHT11);

Servo servo1;

Servo servo2;

Servo servo3;

void setup () (

Serial.beegin(9600)

Lcd.begin(20,4);

dht1.begin();

dht2.begin();

dht3.begin();

pinMode (5, INPUT);

pinMode (3, INPUT);

pinMode (A0, INPUT);

pinMode (A1, INPUT);

pinMode (A2, INPUT);


pinMode (OUTPUT1, OUTPUT);

pinMode (OUTPUT2, OUTPUT);

pinMode (OUTPUT3, OUTPUT);

sp1=30;

sp2=45;

sp3=65;

tempp=0;

m1=0;

m2=0;

m3=0;

servol1.attach (OUTPUT1);

servol2.attach (OUTPUT2);

servol3.attach (OUTPUT3);

void loop () {

humed1= dht1.readHumidity();

temp1= dht1.readTemperature();

humed2= dh2.readHumidity();

temp2= dht2.readTemperature();

humed3= dht3.readHumidity();

temp3= dht3.readTemperature();

tempp= (temp1+temp2+temp3) /3;

pulsadormas=digitalRead (5);

pulsadormenos=digitalRead (3);

lcd.clear ();

lcd.print ("Temp promedio "+String (tempp) + "C ");

lcd.setCursor (0, 1);

lcd.print ("Humedad "+String (humed1) + "%");

lcd.print (String (humed2) + "%");

lcd.print (String (humed3) + "%");

lcd.setCursor (0, 2);


lcd.print ("Setpoin "+String (sp1) +"% "+String (sp2) +"% "String (sp3) ++"% ");

lcd.setCursor (0, 3);

lcd.print ("Open "+String (m1) +"% "+String (m2) +"% "String (m3) ++"% ");

delay (100);

if (pulsadormas==LOW)

sp1=sp1+1;

sp1=sp2+1;

sp1=sp3+1;

delay (50);

else

if(pulsadoremos==LOW)

sp1=sp1-1;

sp2=sp2-1;

sp3=sp3-1;

delay (50);

if (humed1<sp1) //sensor 1

servol.write (143);//100% de apertura

m1=100;

else

if (humed1>"sp1&&humed1<sp2) //75% de apertura

;
servol.write (133);

m1=75;

if (humed1>=sp2&&humed1<sp3) //50% de apertura

servol.write (117);

m1=50;

if (humed1>=sp3) //0% de apertura

Servo1.write (90);

m1=0;

if (humed2<sp1) //sensor 2

Servo2.write (143) ;//100% de apertura

M2=100;

else

if (humed2>sp1&&humed2<sp2) //75% de apertura

servo2.write(133);

m2=75;
}

if (humed2>sp2&&humed2<sp3) //50% de apertura

servo2.write (117);

m2=50;

if(humed3>sp3) //0% de apertura

Servo1.write (117);

m2=50;

}if(humed3<sp3)// 0% de apertura

//servol.write(117);

//delay(1000);

//servol.write(133);

//delay(1000);

//servol.write(143);

//delay(1000);

You might also like