Threshold to turn on and off DC Motor

Is there something wrong with my code???
Ive been working on this a couple of days and the motor wont turn on as soon as the threshold is exceeded.

#define PIN_SENSOR A0
#define PIN_SWITCH 9

float target = 50;

void setup()
{
pinMode(PIN_SENSOR, INPUT);
pinMode(PIN_SWITCH, OUTPUT);

Serial.begin(9600);
}

float getTemperature() {
float data = analogRead(PIN_SENSOR);
return data ;
}

void loop()
{
// Temperature read
float c = getTemperature();

// Regulation
if (c > target)
{
digitalWrite(PIN_SWITCH, HIGH);
Serial.print("\nMotor is ON");
Serial.println(c);
}
else {
digitalWrite(PIN_SWITCH, LOW);
Serial.print("\nMotor is OFF");
Serial.println(c);
}

delay(1);
}

The goal of my code is to turn on and off a dc motor when the analog signal that is being read is greater than a certain threshold. The dc motor is connected via a transistor which acts as a switch. Is there anything missing or i forgot to add to the code.

#define PIN_SENSOR A0
#define PIN_SWITCH 9

float target = 50;

void setup()
{
pinMode(PIN_SENSOR, INPUT);
pinMode(PIN_SWITCH, OUTPUT);

Serial.begin(9600);
}

float getTemperature() {
float data = analogRead(PIN_SENSOR);
return data ;
}

void loop()
{
// Temperature read
float c = getTemperature();

// Regulation
if (c > target)
{
digitalWrite(PIN_SWITCH, HIGH);
Serial.print("\nMotor is ON");
Serial.println(c);
}
else {
digitalWrite(PIN_SWITCH, LOW);
Serial.print("\nMotor is OFF");
Serial.println(c);
}

delay(1);
}

This line is not needed pinMode(PIN_SENSOR, INPUT);

analogRead() returns type int (0-1023), why are you using float.

Show us a good schematic & image of your circuit.
Posting images: