Programing help with temperature

Hi,
I wrote small routine that will do what I thinking it is what you are looking for. The only you need to do it is add the temperature variable and see it is work. Again I do not know if this is what you are looking.

byte pinxx = 0;//turn on mchine pin output
int T ; //temperature variable
void setup() {
// put your setup code here, to run once:
pinMode(pinxx , OUTPUT); //nachine turn on pin
}

void loop() {
// put your main code here, to run repeatedly:
//instruction here to get the temperature T=xxxx
if (T >= 1) {
temp_falling(); //wait until temperature reach 1 degree +
}
delay(1000);
}
//***************************************************
void temp_falling() {
digitalWrite(pinxx, HIGH); //turn the machine ON
do {
//loop here until temperature drop to -5
//instruction to get the temperature T= xxxx
} while (T < -4);
digitalWrite(pinxx, LOW); //turn the machine OFF
}
//****************************************************