I'm trying to build a timer to see the time it takes for an object to pass form one sensor to another. For this to work I need to know how to set up timer then getting that time to be displyed on an LCD screen.
I am out of my depth on this one, any help would be welcomed with open arms.
The first sensor when tripped should store a starttime variable value using the millis() command and the second sensor should store a stoptime variable value also using the millis() command. Then you just have to subtract the starttime from the stoptime and you will have the elapsed time in milliseconds. You can then scale that and send it to your display.
What I would do is use the normal method of polling the pin for sensor 1, using digitalRead. When it indicated that the sensor went HIGH (or LOW), I'd call pulseIn with the pin for sensor 2, ahd HIGH. When pulseIn returns, it returns either 0 (sensor 2 never went HIGH) or the length of time, in milliseconds, that it waited for the pin to go HIGH. Then, you could calculate the speed of the object of you knew the distance between the sensors.