Measure time between two triggered photoresistors

Hi,

I want to measure the time in milliseconds from lightPin1 changes in value, to lightPin2 changes in value. It's going to be sort of a speedometer.

I have read this post: Arduino Basics
I got the photoresistor to detect change, but how do I implement a second photoresistor?

I know I can use the example below to measure the time, and then just use a real-world distance to calculate speed (km/h):

When lightPin1 detect change{
  startTime = millis();
}
When lightPin2 detect change{
  endTime = millis();
  time = endTime - startTime;
  Serial.print("Time: ");
  Serial.println(time);
}

I got the photoresistor to detect change

How? I don't see any code.

but how do I implement a second photoresistor?

Just like the first one, except on a different pin.

I know I can use the example below to measure the time, and then just use a real-world distance to calculate speed (km/h):

Depending on how far apart the sensors are, and the speed of the object, you might need to use micros() instead of millis() (to get better accuracy).