0% found this document useful (0 votes)
31 views2 pages

Codigo Hidroponia

Uploaded by

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

Codigo Hidroponia

Uploaded by

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

#include <LiquidCrystal_I2C.

h>

#include <Wire.h>

LiquidCrystal_I2C lcd(0x27,16,2);
int rojo=6;
int ama=5;
int verde=4;
int bomba=3;
int buzzer=2;
int rele=7;
void setup() {
lcd.init();
lcd.backlight();
lcd.clear();
pinMode(rojo,OUTPUT);
pinMode(ama,OUTPUT);
pinMode(verde,OUTPUT);
pinMode(bomba,OUTPUT);
pinMode(buzzer,OUTPUT);
pinMode(rele,OUTPUT);
}

void loop() {
int humedad=analogRead(A0);
int nivel=analogRead(A1);

int ni = map(nivel,0,660,0,100);
int hu = map(humedad,1023,0,0,100);
lcd.clear();
lcd.setCursor (0,0);
lcd.print("Humedad: ");
lcd.print(hu);
lcd.print("%");

lcd.setCursor (0,1);
lcd.print("Nivel: ");

if (ni>90){
digitalWrite(verde,HIGH);
digitalWrite(rojo,LOW);
digitalWrite(ama,LOW);
digitalWrite(buzzer,LOW);
lcd.print("Alto");
}
if (ni<=90 && ni>=65){
digitalWrite(verde,LOW);
digitalWrite(rojo,LOW);
digitalWrite(ama,HIGH);
digitalWrite(buzzer,LOW);
lcd.print("Medio");
}
if (ni<=64){
digitalWrite(verde,LOW);
digitalWrite(rojo,HIGH);
digitalWrite(ama,LOW);
digitalWrite(buzzer,HIGH);
lcd.print("Bajo");
}
if (hu<40){
digitalWrite(bomba,HIGH);
digitalWrite(rele,LOW);
}
if (hu>=40){
digitalWrite(bomba,LOW);
digitalWrite(rele,HIGH);
}

delay(1000);
}

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy