# Tempetare range

Hello there,
I'm a beginner at Arduino and ı wanna do a project about temperature sensors. What do I need to do to run it in a certain temperature range?
For example, operating the heater in the range of 22-26 degrees.

sinirdeger1= 22
sinirdeger2= 26

if (temp<=sinirdeger1 || temp<=sinirdeger2)
{
digitalWrite(role1,HIGH);

}
else
{
digitalWrite(role1,LOW);
}

Do you want the heater to turn on if the temperature is below 22 and off it above 26 ?

``````sinirdeger1= 22
sinirdeger2= 26

if (temp<=sinirdeger1 || temp<=sinirdeger2)
``````

if temp is less than 22 it is bound to be less than 26. Check the logic of your test

Yes, exactly.

Then you need to program

``````if temperature < 22
turn on heater
else if temperature greater than 26
turn off the heater
``````

Is that what your code does ?

All I need is it.

Then try to write it for yourself

1 Like

Well would that be degrees F or C? What sensor are you using to get temperature?

Simple On/Off is what I am seeing but how well it works will depend on how well the heaters are controlled because depending on your application turning a heater Off at 26 degrees C or F the temp is likely to creep above that set point after the heating source (element) is turned off. Anyway you may have some considerations to make.

Ron

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.