Good afternoon, I am working on a project and I am trying to connect to photoresistors to the Arduino to read a time difference between when each resistor's voltage changes so I can calculate the velocity of a projectile. Any advice would be very helpful on how to do this. Thank you.
int lightPin = 0; //define a pin for Photo resistor
int threshold = 500;
void setup(){
Serial.begin(9600); //Begin serial communcation
pinMode(13, OUTPUT);
}
void loop(){
Serial.println(analogRead(lightPin));
if(analogRead(lightPin) > threshold ){
digitalWrite(13, HIGH);
Serial.println("high");
}else{
digitalWrite(13, LOW);
Serial.println("low");
}
delay(50);
}