help with loop


I have a loop in which i am compering a light set point and depending on the set point the light dims up/down.i have a delay in the loop so every second it adjusts the light by a step. I want to integrate a PIR motion sensor which will trigger a timer and if there is no presence it will switch of an output if the timer timesout

light_auto.ino (2.89 KB)

It would be easier if you had posted your code here to avoid the need to download it. Please read this before posting a programming question and post your code.

The first thing to do will be to get rid of the delay()s in your current program because nothing can happen while the delay() happens. Look at the BlinkWithoutDelay example in the IDE to see how to use millis() for timing.