78Views2Replies

Author Options:

help with my arduino project Answered

I'm trying to setup my home aquaponics automation and im very new to this. i followed instructions on how to setup me water temperature sensor with LCD display and that's working beautifully.
Now i want to add code lines for low temperature to activate a relay and high temperature turn off the relay. my relay is on digital 8
here's my code so far its the 3rd and 4th attachments i'm trying to add variables to turn on and off a relay on digital pin 8 and i just dont know how to write it.
can anyone give me some help with this. heres my code so far:

see attached code

Discussions

0
None
SerialQ

4 years ago

Try some IF statments:

#define mintemp 20 //minimum temperature

#define hightemp 30 //maximum temperature

int temp; //store the sensor-readings

if (temp < mintemp){

//... whtat to do if temp is under minimum

digitalWrite(8,HIGH); //

}

if (temp > hightemp){

//... whtat to do if temp is over maximum

digitalWrite(8, LOW);

}

MAybe you want to use an integer to add some tolerance. if not it could happen, that the relay switches between on and off all the time because the value is flapping between 29.9 and 30...

0
None
iam_maker_leo

4 years ago

There is no your attached code.

Then I(We) can help you.