Temperature sensorwith fan and "heater"

So unlucky that nobody on internet did this so now I have to ask you for the advice. Oh well.
Temperature sensor that turns on fan when hot and heater (in this project just a diode) when cold sounds simple (and probably is) but unfortunately I’m stuck in writing the code. The way I know it is because on Arduino simulator not a thing happens. I whould make the project without checking with you but I think this is safer. Thanks.

int tempPin = A1;
int fan = 11;
int led =8;
int temp;
int tempMin = 20;
int tempMax =30;

void setup() {
  pinMode(fan, OUTPUT);
  pinMode(led, OUTPUT);
  pinMode(tempPin, INPUT);
}

void loop(){
  if(temp<tempMin){
    digitalWrite(led,HIGH);
  } if (temp>tempMax) 
    digitalWrite(fan,HIGH);
    else    digitalWrite(led,LOW);
            digitalWrite(fan,LOW);
}int readTemp() {  
  temp = analogRead(tempPin);
  return temp * 0.48828125;
}

arduino-temperature-fan-speed-control.png

if (temp>tempMax)
    digitalWrite(fan,HIGH);
  else    digitalWrite(led,LOW);
  digitalWrite(fan,LOW);

You are missing some curly brackets there.

if (temp>tempMax)
{
    digitalWrite(fan,HIGH);
}  
else 
{ 
   digitalWrite(led,LOW);
   digitalWrite(fan,LOW);
}

Compiles, untested.

Must have been done a zillion times.

Yeah, but not incorrectly as OP is trying to do. Makes it more challenging to find code that doesn't work, since the only place code like that is posted is here.

if ( tempMin < temp < tempMax )

The syntax in this if statement is not right. You need a comparison for each condition. You can’t string the comparisons like that.

if(temp >  tempMin && temp <  tempMax)   // temp is OK turn everything off

And you have no cases where if temp = tempMin or temp = tempMax. It may be no problem, but it is good to cover ALL the possible cases.

if(temp >=  tempMin && temp <=  tempMax)