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);
}