# Tempetare range

**URL:** <https://forum.arduino.cc/t/tempetare-range/920645>\
**Category:** Sensors\
**Created:** [November 1, 2021, 8:50am UTC](https://forum.arduino.cc/t/tempetare-range/920645 "2021-11-01T08:50:20Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![erhanilter](https://avatars.discourse-cdn.com/v4/letter/e/ec9cab/32.png) [@erhanilter](https://forum.arduino.cc/u/erhanilter)\
**Post date:** [November 1, 2021, 8:50am UTC](https://forum.arduino.cc/t/tempetare-range/920645/1 "2021-11-01T08:50:20Z")

</div>

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);  
}

---

<div class="post-metadata">

**Author:** ![UKHeliBob](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/ukhelibob/32/215663_2.png) [@UKHeliBob](https://forum.arduino.cc/u/UKHeliBob)\
**Post date:** [November 1, 2021, 8:58am UTC](https://forum.arduino.cc/t/tempetare-range/920645/2 "2021-11-01T08:58:49Z")

</div>

> [@erhanilter](#):
>
> operating the heater in the range of 22-26 degrees.

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

```arduino
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

---

<div class="post-metadata">

**Author:** ![erhanilter](https://avatars.discourse-cdn.com/v4/letter/e/ec9cab/32.png) [@erhanilter](https://forum.arduino.cc/u/erhanilter)\
**Post date:** [November 1, 2021, 9:01am UTC](https://forum.arduino.cc/t/tempetare-range/920645/3 "2021-11-01T09:01:56Z")

</div>

> [@UKHeliBob](#):
>
> Do you want the heater to turn on if the temperature is below 22 and off it above 26 ?
> 
> ```arduino
> 
> ```

Yes, exactly.

---

<div class="post-metadata">

**Author:** ![UKHeliBob](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/ukhelibob/32/215663_2.png) [@UKHeliBob](https://forum.arduino.cc/u/UKHeliBob)\
**Post date:** [November 1, 2021, 9:14am UTC](https://forum.arduino.cc/t/tempetare-range/920645/4 "2021-11-01T09:14:20Z")

</div>

Then you need to program

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

```

Is that what your code does ?

---

<div class="post-metadata">

**Author:** ![erhanilter](https://avatars.discourse-cdn.com/v4/letter/e/ec9cab/32.png) [@erhanilter](https://forum.arduino.cc/u/erhanilter)\
**Post date:** [November 1, 2021, 9:47am UTC](https://forum.arduino.cc/t/tempetare-range/920645/5 "2021-11-01T09:47:13Z")

</div>

> [@UKHeliBob](#):
>
> ```arduino
> 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.

---

<div class="post-metadata">

**Author:** ![UKHeliBob](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/ukhelibob/32/215663_2.png) [@UKHeliBob](https://forum.arduino.cc/u/UKHeliBob)\
**Post date:** [November 1, 2021, 9:53am UTC](https://forum.arduino.cc/t/tempetare-range/920645/6 "2021-11-01T09:53:27Z")

</div>

> [@erhanilter](#):
>
> All I need is it.

Then try to write it for yourself

---

<div class="post-metadata">

**Author:** ![Ron\_Blain](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/ron_blain/32/1126393_2.png) [@Ron\_Blain](https://forum.arduino.cc/u/Ron_Blain)\
**Post date:** [November 2, 2021, 10:28pm UTC](https://forum.arduino.cc/t/tempetare-range/920645/7 "2021-11-02T22:28:04Z")

</div>

> [@erhanilter](#):
>
> For example, operating the heater in the range of 22-26 degrees.

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

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [May 1, 2022, 10:28pm UTC](https://forum.arduino.cc/t/tempetare-range/920645/8 "2022-05-01T22:28:49Z")

</div>

Closed on May 1, 2022, 10:28pm UTC

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