IR Alarm System Code Not Working, Serial Outputs not matching sensor data

Hi,

I am relatively new to Arduino, and this problem is a bit beyond me. I have a piece of modified open source code that was working before, but then stopped working properly. I have an IR sensor set to send a pulse to an analog pin when it detects motion, but the Serial Outputs are sending non=existent data. The TX light is also blinking in time with the Serial Outputs, but I assume this is normal.

Here is a link to the original program:

https://raw.githubusercontent.com/jedgarpark/Make_PIR_Sensor/master/MAKE_PIR_Sensor.pde

Here is my modified program:

int ledPin = 11;                
int inputPin = A1;               
int pirState = LOW;           
int val = 0;  


void setup() {
  pinMode(ledPin, OUTPUT);      
  pinMode(inputPin, INPUT);     
  Serial.begin(9600);
}

void loop(){

    
      
    if (pirState == LOW) {
      
      Serial.println("Motion detected!");
     
      pirState = HIGH;
    }
   else {
      digitalWrite(ledPin, LOW); // turn LED OFF
    
      delay(300);    
      if (pirState == HIGH){
    
      Serial.println("Motion ended!");
    
      pirState = LOW;
    }
  }
}

By:

if (pirState == LOW) {

do you mean to:

if (analogRead(pirState) == LOW) {

?