/* ENGINEER OF NONE https://www.youtube.com/channel/UCL-jpfIywlIeSoJ-vyskomQ/videos This example code is in the public domain */ int thermistorPin = A0; // thermistor connected to A0 int relayPin = 10; // relay connected to 9 int humidityPin = A1; // short connected to A1 int ledPin = 11; // led connected to 10 int thermistorValue = 0; // variable to store int thermistorTriggerValue = 300; // thermistor trigger relay value int humidityPinState = 0; // humidity inicial value void setup() { pinMode(relayPin, OUTPUT); // sets the digital pin as output pinMode(humidityPin, INPUT); // sets the analog pin as input pinMode(ledPin, OUTPUT); // sets the digital pin as output Serial.begin(9600); // setup serial delay(60000); } void loop() { thermistorValue = analogRead(thermistorPin); // read the input pin Serial.println(thermistorValue); // debug value if(thermistorValue >= thermistorTriggerValue) // trigger the relay if the value is greater on equal to the thermistor trigger value { digitalWrite(relayPin, HIGH); // turns the relay on digitalWrite(ledPin, HIGH); delay(180000); // waits for 5 min digitalWrite(relayPin, LOW); // turns the relay off digitalWrite(ledPin, LOW); // turns the led off delay(300000); // waits for a second } else { digitalWrite(relayPin, LOW); // turns the relay off delay(1000); // waits for a second digitalWrite(ledPin, LOW); // turns the led off delay(1000); // waits for a second } humidityPinState = digitalRead(humidityPin); if(humidityPinState == HIGH) { digitalWrite(relayPin, HIGH); // turns the relay on delay(180000); // waits for 5 min digitalWrite(relayPin, LOW); // turns the relay off delay(300000); // waits for a second } else { digitalWrite(relayPin, LOW); // turns the relay off delay(1000); }}