Troubleshooting regarding HC SR501 with Adafruit Pro Trinket

Hopefully I'm posting this in the correct area. I have made a little motion based alarm system using the HC SR501 along with a pro trinket and an IOT relay. The alarm part is a little MS-190 motor siren. Pretty nifty except that a little bit after the pro trinket boots up it wants to go off twice for no reason. It does this over the period of about one minute. After that it behaves correctly. The siren is kind of loud so I can't have it going off twice each time I set the alarm. The code is borrowed. The only part I've changed I believe was to adapt what pins I'm using. I'm wondering if this is a problem with the HCSR501 or maybe the pro trinket? Any help is much appreciated. I'll post the code here:

//Henry's Bench
// HC-SR501 Motion Detector
// Sample Sketch THIS ONE IS FOR THE PRO TRINKET

int ledPin = 5; // YELLO WIRE LED on Pin 13 of Arduino
int pirPin = 8; // BLUE WIRE Input for HC-S501

int pirValue; // Place to store read PIR Value

void setup() {

pinMode(ledPin, OUTPUT);
pinMode(pirPin, INPUT);

digitalWrite(ledPin, LOW);

}

void loop() {
pirValue = digitalRead(pirPin);
digitalWrite(ledPin, pirValue);

}

I don't know about the Trinket as opposed to genuine Arduino boards, but often the bootloader flashes the onboard LED when it starts. Try using a different pin to drive the alarm.

I'm using pin 5 for that wire. Oh I see I didn't change it to that in the comment part. But yes I'm using pin 5. 13 is not in use except for the on board led.

I see now, calling it ledPin threw me for a minute.
Try changing this:

 pinMode(ledPin, OUTPUT);
 pinMode(pirPin, INPUT);

 digitalWrite(ledPin, LOW);

to this:

digitalWrite(ledPin, LOW); 
pinMode(ledPin, OUTPUT);
pinMode(pirPin, INPUT);

 digitalWrite(ledPin, LOW);

Thanks. I will try that one tomorrow. Timing the upload is tricky because of the pro trinket bootloader.

Hmm. That didn't seem to do the trick.

I found this info on the datasheet for the HC SR501.

"Once the module is powered allow the module to calibrate itself for few minutes, 2 minutes is a well settled time."

So I think what I need to figure out is a work around so it won't send voltage to my siren during that test.