Help to make a "simple lap timer"

Hello everybody! I am a science teacher and just a beginner of arduino. Next week we have an RC Car Race in our school and I want to make a lap timer with arduino. I have done tens of searches but no luck about just a simple lap timer. Due to lack of the time can you please help me?

I just need to keep the each car's lap time and show on the simple 4 digit screen or common 16x2 lcd screen. I have photo reseptor and IR reseptor. Thanks a lot.

Have you written any sketches?
What hardware do you have? Give links.
What electronics background do you have?

Normally we help 'you' write code based on your current sketch.

hi thanks for quick response. I have the arduino Uno and the sensors contained by almost all arduino learning kits. But i didnt write any codes by myself. Just done a few projects like obstacle avoider robot with only copy-paste and a little modification of codes.

So far I can make the circuit but I need both the codes and schematic if possible. Thanks again. Much appreciated.

I Goggled 'lap timer arduino' and got this in 3 seconds.

/* Single lane slot car timer
  Written by TheInsanityUnleashed @ Youtube
  ----------------------------------------------------

           PhotoR     10K
  +5    o---/\/\/--.--/\/\/---o GND
                  |
  Pin A0 o----------


  Pin 9 ------Piezo-----gnd


  Sensitivity Pot --------- Pin A1

  ----------------------------------------------------
*/

#include <LiquidCrystal.h>

//variables
const byte lightPin = 0;
const byte speakerPin = 9;
int lightSensor = 0;
unsigned long lapMillis = 0;
unsigned long startMillis = millis();
unsigned long bestMillis = 9999999;
float lapTime = 0.00;
float bestLap = 0.00;
boolean firstTrigger = true;
boolean newBest = false;

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

void setup()
{
  lcd.begin(16, 2);
  lcd.setCursor(0, 0);
  lcd.print("Start!           ");
  Serial.begin(9600);
  pinMode(speakerPin, OUTPUT);
  digitalWrite(speakerPin, LOW);
}

void loop()
{

  //reading from light sensor
  lightSensor = analogRead(lightPin);


  //If car detected
  if (lightSensor < analogRead(1))
  {


    //determine lap time in milliseconds
    lapMillis = millis() - startMillis;
    startMillis = millis();

    lapTime = lapMillis / 1000.00;

    //if firs trigger print race started
    if (firstTrigger == true)
    {
      lcd.setCursor(0, 0);
      lcd.print("Race Started!    ");
    }

    //print if not first trigger
    if (firstTrigger != true)
    {
      Serial.print("lapTime: ");
      Serial.println(lapTime);
      Serial.print("lapMillis: ");
      Serial.println(lapMillis);
      //print lap time
      lcd.setCursor(0, 0);
      lcd.print("Last: ");
      lcd.print(lapTime);
      lcd.print("       ");
    }


    //if last lap is better than best lap
    if (lapMillis < bestMillis && firstTrigger != true)
    {
      bestMillis = lapMillis;
      bestLap = lapTime;
      Serial.print("bestLap: ");
      Serial.println(bestLap);
      //print best lap time
      lcd.setCursor(0, 1);
      lcd.print("Best: ");
      lcd.print(bestLap);
      lcd.print("      ");
      newBest = true;
    }

    //beep piezo
    if (newBest == true)
    {
      digitalWrite(speakerPin, HIGH);
      delay(25);
      digitalWrite(speakerPin, LOW);
      delay(25);
      digitalWrite(speakerPin, HIGH);
      delay(25);
      digitalWrite(speakerPin, LOW);
      delay(25);
      digitalWrite(speakerPin, HIGH);
      delay(25);
      digitalWrite(speakerPin, LOW);
      delay(25);
      digitalWrite(speakerPin, HIGH);
      delay(25);
      digitalWrite(speakerPin, LOW);
      newBest = false;
    }
    else
    {
      digitalWrite(speakerPin, HIGH);
      delay(150);
      digitalWrite(speakerPin, LOW);
    }

    firstTrigger = false;
    Serial.println("----------------");

  }
}

thanks for that but I already looked that and no schematics available. Unfortunately I cannot figure out from the code where and how should I connect the parts and arduino. Any further help appreciated.

What LCD do you have?

Do you have a LDR (light dependent resistor)?

Do you have a Piezo speaker.

Take a picture of the above and show it to us.

.

hero04:
thanks for that but I already looked that and no schematics available. Unfortunately I cannot figure out from the code where and how should I connect the parts and arduino. Any further help appreciated.

If that is not specific enough for you, it is unlikely that you will obtain enough information in forum replies, to get it done. There is connection info at the top of the program...

larryd:
What LCD do you have?

Do you have a LDR (light dependent resistor)?

Do you have a Piezo speaker.

Take a picture of the above and show it to us.

.

Yes I have LCD, LDR and buzzer speaker. Same as pictures below:

This will get you close.
Ignore pins 17 and 18 on the schematic LCD.

Replace the Piezo with a LED if you don't have a Piezo or leave pin D9 disconnected.

thanks a lot. will try that. and how about the codes? can i use the code that you mentioned from youtube video?

Use the sketch from post #3, it came from that YouTube video.