نمایشگر سریال مانیتور هست

سنسور هم htu21d

مال کنترل دستگاه جوجه کشی هستش

اینم کد

#include <Wire.h>
#include "SparkFunHTU21D.h"

HTU21D myHumidity;

float Hup = 62;
float Tup = 37.6;
float Hdown = 58;
float Tdown = 37.4;

void setup() {
// put your setup code here, to run once:
pinMode(38,OUTPUT);
pinMode(40,OUTPUT);
pinMode(42,OUTPUT);
pinMode(44,OUTPUT);

myHumidity.begin();
Serial.begin(9600);

}

void loop() {
// put your main code here, to run repeatedly:
float humd = myHumidity.readHumidity();
float temp = myHumidity.readTemperature();

Serial.println();
Serial.print("Temp:");
Serial.print(temp, 1);
Serial.println("C");
Serial.print("Humd:");
Serial.print(humd, 1);
Serial.println("%");

Serial.print("Relay(T) 1 = ");
Serial.println(digitalRead(38));
Serial.print("Relay(T) 2 = ");
Serial.println(digitalRead(40));
Serial.print("Relay(H) 3 = ");
Serial.println(digitalRead(42));
Serial.print("Relay(H) 4 = ");
Serial.println(digitalRead(44));
Serial.println("Tup:37.6;");
Serial.println("Tdown:37.4;");
Serial.println("Hup:62;");
Serial.println("Hdown:58;");
Serial.println();


if(humd <= Hdown)
{
hdown();
}

if(humd >= Hup)
{
hup();
}

if(temp <= Tdown)
{
tdown();
}

if(temp >= Tup)
{
tup();
}

delay(2000);
}

void hup()
{
digitalWrite(38,LOW);
digitalWrite(40,LOW);
}

void hdown()
{
digitalWrite(38,HIGH);
digitalWrite(40,HIGH);
}

void tup()
{
digitalWrite(42,LOW);
digitalWrite(44,LOW);
}

void tdown()
{
digitalWrite(42,HIGH);
digitalWrite(44,HIGH);
}