HKJ-lygte:
Turn the timer on the PIR all the way down, as short as possible then try something like this:#define inputPin 3
#define ledPin 13
unsigned long timer;
void setup() {
//Serial.begin(9600);
pinMode(ledPin, OUTPUT);
pinMode(inputPin, INPUT);
timer = millis();
}
void loop() {
// When PIR active set timer to 0.1 second
if (digitalRead(inputPin)) timer = millis() + 300;
// When timer is active the output will be turned on
digitalWrite(ledPin,timer>millis());
}
It uses a timer to maintain output on without interruptions as long as the PIR signals movement, depending on how fast the PIR changes it output you may have to increase the "+ 300" value.
Thanks for your reply, will implement your code. I have already reduced the timer to the minimum( which one article states was 3 seconds for the sensor I.e the LED will stay on for 3 seconds) will let you know how it goes.
But before that could you please explain your code a little more?
Thanks