Codigo arduino
Sistema de Riego inteligente por Gabriel Mellace
Fecha: 01/05/2013
Aclaraciones para lectura de la logica:
un dia = 86400 segundos
1/3 de dia = 28800 segundos 2/3 de dia = 57600 segundos
3 horas = 10800 segundos
16 horas = 64800 segundos
*/
#include
#include
//#include
#include "DHT.h"
#define DHTPIN 30 #define DHTTYPE DHT22
DHT dht(DHTPIN, DHTTYPE);
// CONFIGURACION DISPLAY
LiquidCrystal lcd(8, 9, 4, 5, 6, 7);
int lcd_key = 0;
int adc_key_in = 0;
int botonactual = 0;
#define btnRIGHT 3 #define btnUP 1
#define btnDOWN 2
#define btnLEFT 0
#define btnSELECT 4
#define btnNONE 5
int read_LCD_buttons()
{
adc_key_in = analogRead(0);
if (adc_key_in > 1000) return btnNONE;
if (adc_key_in < 50) return btnRIGHT;
if (adc_key_in < 195) return btnUP;
if (adc_key_in < 380) return btnDOWN;
if (adc_key_in < 555) return btnLEFT; if (adc_key_in < 790) return btnSELECT;
return btnNONE;
}
// CONFIGURACION ETHERNET
/*byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = { 192 ,168 ,1 ,122 };
byte gateway[] = { 192 ,168 ,1 ,1 }; byte subnet[] = { 255 ,255 ,255 ,0 };
EthernetServer server(80);
EthernetClient client;
String readString = String(30);*/
// VARIABLES DE RIEGO
long segundosTranscurridos = 28800;
int flaggedTime = 0;
// VARIABLES DE PERSISTENCIA
boolean persistentHumidity = false;
boolean persistentTemp = false;
boolean flagHumidificar=false;
// VARIABLES DE PINES
int pinRiego = 34;
int pinLuz = 35; int pinHumedad = 36;
int pinUV = 38;
int pinCool = 39;
int pinAlarma = 48;
int sensorHumedad = A8;
// VARIABLES OPTIMIZACION DE LECTURA SENSORIAL
int temperatura = 0;
int humedad = 0; int humedadSuelo = 0;
void setup(){
digitalWrite(pinRiego,HIGH);
digitalWrite(pinLuz,HIGH);
digitalWrite(pinUV,HIGH);
digitalWrite(pinCool,HIGH); ...
Regístrate para leer el documento completo.