You'll need to have a variable storing the state of the pin, so you can compare that with the state as you read it at the top of loop(). From that you'll be able to see if the pin has just gone low or high in which case start a timer for the new state and end the timer for the old state which you would have started when the state last changed. If the state hasn't changed, then don't do anything, leave the timer running.
By timer I mean record millis() into a variable to "start" and subtract that from the millis() later on, to "stop".
Have a look here to see how to handle the state change.
#include <LiquidCrystal.h> // initialize the library with the numbers of the interface pins LiquidCrystal lcd(12, 11, 5, 4, 3, 2); const int InfraredSensorPin =7;//Connect the signal pin to the digital pin 4 const int LedDisp = 13; unsigned long time; void setup() {
const int InfraredSensorPin =8;//Connect the signal pin to the digital pin 4
const int LedDisp = 13;
unsigned long xronos_ON=0;
unsigned long xronos_OFF=0;
unsigned long xronos_NOW=0;
boolean ON = false;
boolean OFF= false;
const int InfraredSensorPin =8;//Connect the signal pin to the digital pin 4
const int LedDisp = 13;
unsigned long xronos_ON=0;
unsigned long xronos_OFF=0;
unsigned long xronos_NOW=0;
float time_ON=0;
float time_OFF=0;
boolean ON = false;
boolean OFF= false;