chronograph

Hi

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.

You don't need to use a timer to measure the duration of a pulse. Have a look at the pulseIn command: http://www.arduino.cc/en/Reference/PulseIn

Should be a pretty simple program.

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.

Here is the info on millis()

Make sense?

Lefty

Have a look at the pulseIn command

Mem;

How would you use the pulseIn command? It sounds like he has two seperate sensors, a start and stop sugnal.

Lefty

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.

Why not use the interrupt rather than polling?