PID Output is always 0

Hello, I am working on PID temperature fan controller which cools down the material with a dc motor fan until the thermistor gets voltage of the setpoint at desired temperature. However, I keep getting Output=0 after myPid.Compute(). The hardware is not a problem as the fan and the thermistor work individually. Could you please tell me what the problem is?

Thank you for your help.

#include <PID_v1.h>
double Setpoint, Input, Output;
float Kp = 100, Ki = 15, Kd = 2;
PID myPID(&Input, &Output, &Setpoint, Kp, Ki, Kd, DIRECT);

int thermistor = A0;
int Vo;
float R1 = 10000;
float logR2, R2, T, Tc, Tf;
float c1 = 1.009249522e-03, c2 = 2.378405444e-04, c3 = 2.019202697e-07;
float t;

int speedPin = 5;
int dir1 = 4;
int dir2 = 3;
int mSpeed = 255;

void setup() {
  
pinMode(thermistor, INPUT);
  pinMode(speedPin, OUTPUT);
  pinMode(dir1, OUTPUT);
  pinMode(dir2, OUTPUT);
  Vo = analogRead(thermistor);
  Input = map(Vo, 0, 1023, 0, 255);
  Setpoint = map(495, 0, 1023, 0, 255);
  myPID.SetMode(AUTOMATIC);
  myPID.SetOutputLimits(0,255);
  Serial.begin(9600);
}

void loop() {
  Vo = analogRead(thermistor);        // Convert the voltage into the temperature
  R2 = R1 * (1023.0 / (float)Vo - 1.0);
  logR2 = log(R2);
  T = (1.0 / (c1 + c2*logR2 + c3*logR2*logR2*logR2));
  T = T - 273.15;                                   // Until here

  t = t + 0.5;                                          // Measuring time for later calculation for PID characteristics

  Input = map(Vo, 0, 1023, 0, 255);
  myPID.Compute();
  digitalWrite(dir1, HIGH);
  digitalWrite(dir2, LOW);
  analogWrite(speedPin, Output);
 

//  Serial.print("Thermistor Voltage: ");
//  Serial.print(Vo);
//  Serial.print("V ");
//  Serial.print("Temperature: ");
//  Serial.print(T);
//  Serial.println(" C");
//
//  Serial.print("Output: ");
//  Serial.println(Output);
//  
//  Serial.print("- Time: ");
//  Serial.print(t);
//  Serial.println("s");

  Serial.print("Input: ");
  Serial.print(Input);
  Serial.print(", Output: ");
  Serial.print(Output);
  Serial.print(", Setpoint: ");
  Serial.println(Setpoint);

  delay(500);
}

Would you mind using code tags (</> button) to post your code?

You don't specify which PID library you are using. The IDE offers me a PID_v2 library, maybe a successor of the library you are using?

With kp=100 your PID most probably is clipping at the upper or lower limit (0, 255). What's the output on Serial Monitor?

For a PID controller used in a cooling system, the controller direction should be REVERSE.

PID myPID(&Input, &Output, &Setpoint, Kp, Ki, Kd, REVERSE);

What values of Setpoint and Input are being displayed on Serial Monitor? If Input is higher than Setpoint then you can expect Output to be a low value.