Make the setpoint of a thermostat with a 1k POT

Hello I'm quite new to arduino and programming in general. I've got the sketch done to read the temp and have everything in that aspect in the serial monitor and have working 'if' statements. I can write to read the POT values (0-1023) but I can't figure out/understand how to use the POT to control what I want the set temp to be. Have looked everywhere but haven't been able to find anything to show how to write it in the sketch. Any help would be appreciated.

Cheers

What is the range of temperature setpoints (0-100, 32-212 ??).

Then something like this for 32 to 212:

setpoint = map(potReading, 0, 1023, 32, 212);

map function

lots of ways to do this but we really need to see how the temperature is being used in the program.

The pot will sweep between 0-1023 and will be compared to the temp using a "if" but heres the fun part if your temp is coming in as degrees C you don't want to compare say 32 against 0-1023 so you will need to use "map" to reset the range of the pot Analog to something more usable first

post you code, codes for a better answer

@Ryan_14, do not cross-post. Do not hijack. Threads merged.

Sorry. Didn’t mean to. Couldn’t find where I originally posted and didn’t turn on notifications…

As to how the thermistor is being used, the setpoint can be whatever I just don’t know/understand how to use the POT in that way. I’ve got a TTC103 through analog pin 0 with a 10k resistor. Now I just need to find out how I write the code to add the POT to make a set point then use the ‘if’ statements to then operate a led if it is more than 2degrees over and a different one if it is 2 degrees under. I’ve already got the ‘if’ statements ready to go. I’ve used the arduino library to get to where I am. Took me a while to understand it, I didn’t want to use a code I don’t understand purely incase of any faults and errors.

#include <math.h>
#define ThermistorPIN 0

double Thermistor(int RawADC){
//Uses Steinhart-Hart Equation
//A= 0.001129148
//B=0.000234125
//C=0.0000000876741

long Resistance; double Temp;
Resistance=10000.0*((1024.0/RawADC)-1);
Temp= log(Resistance);
//Store for easier use

Temp= 1/(0.001129148+(0.000234125*Temp)+(0.0000000876741*Temp*Temp*Temp));
//Steinhart-Hart Equation
Temp= Temp-273.15;
//Kelvin to Celcius

return Temp;
}


void setup(){

Serial.begin(115200);

}
double temp;

void loop(){

temp= Thermistor(analogRead(0));
Serial.println();
Serial.print("Celcius: ");
Serial.println(temp,1);
Serial.println("");
delay(5000);


}

Moderator edit:
</mark> <mark>[code]</mark> <mark>

</mark> <mark>[/code]</mark> <mark>
tags added.

groundfungus: What is the range of temperature setpoints (0-100, 32-212 ??).

Then something this like for 32 to 212:

setpoint = map(potReading, 0, 1023, 32, 212);

map function

Appreciate your help. I've got going from -5, 32. Just random temp. Is there a way to write 'if' temp is 2 degrees greater or 2degrees below set point? Sorry I should given much more detail about what I wanted to happen.

if (abs (temp - setPoint) > 2)

Thank you very much.