LED and IR sensor help

Hi! I’m trying to write a code using the LED on board LED on pin 13 and an attached IR distance sensor.
When no object is within range the LED is off.
From 6-12in the LED blinks.
From 13-18in the LED is lit.

I have my sensor wired to the gnd, 5V, and A2.
Any direction is appreciated.
Here is what I have so far…the Serial Monitor shows 0’s.
I first did a code with just the sensor to get readings for the appropriate heights, which I’m not sure are correct.

int ledPin = 13;
int IRsensor = analogRead(2);
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(ledPin, OUTPUT);
pinMode(IRsensor, INPUT);
}

void loop() {
// put your main code here, to run repeatedly:
Serial.println(IRsensor);
//Heights 6-12inches
if ((IRsensor >=335) && (IRsensor<=172)) {
digitalWrite(ledPin, LOW);
delay(5);
//heights 13-18inches
} else if ((IRsensor >=160) && (IRsensor <=111)) {
digitalWrite(ledPin, HIGH);
} else {
digitalWrite(ledPin, LOW);
}
}

Put this in loop()
int IRsensor = analogRead(2);