GrowBox TulaTeens

https://docs.google.com/document/d/1UOzdLdCdlX1kG_sug-6DnLYK_zawVcfwVauZyDy5xYg/edit?usp=sharing смете

 

код

 

#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include "DHT.h"

#define soil_pin A2
#define voda_pin A3
#define dht_pin A1
#define led_pin 13
#define poliv_pin 12

#define soil_level 600
#define led_bw_time 28800000
#define temp_level 40
#define poliv_bw_time 30000
#define voda_level 300
#define time_of_poliv 5000

DHT dht(dht_pin, DHT22);
LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);

void setup()
{
pinMode(led_pin , OUTPUT);
pinMode(poliv_pin , OUTPUT);
lcd.begin(20, 4);
ld.setCursor(0, 0);
lcd.print("GrowBox of TulaTeens");

}

void loop()
{
//считывание показаний с датчиков
int soil = analogRead(soil_pin);
int voda = analogRead(voda_pin);
float vlaga = dht.readHumidity();
float temp = dht.readTemperature();
lcd.setCursor(0, 1);
lcd.write(("voda") +(voda) ("pochva") + (soil));
lcd.setCursor(0, 2);
lcd.print(("temp") + (temp) ("vlaga") + (vlaga));

if (voda < voda_level) {

if (soil < soil_level && millis() > poliv_time + poliv_bw_time) {

digitalWrite(poliv_pin, 1);
poliv_time = millis();
delay(time_of_poliv);
digitalWrite(poliv_pin, 0);

}

}

else {

lcd.setCursor(0, 3);
lcd.print("Dont work ");
lcd.setCursor(15, 3);
lcd.print("poliv");

}

if (temp > temp_level) {

if (millis() > led_time + led_bw_time) {

if (led_st = 0) {

digitalWrite(led_pin, 1);
led_st = 1;
led_time = millis;
}

else {

digitalWrite(led_pin, 0);
led_st = 0;
led_time = millis;

}

}

else {
lcd.setCursor(0, 3);
lcd.print("Dont work svet");
digitalWrite(led_pin, 0);
}

}